控制器:YII CGridView错误
public function actionItem($textdata){
$dataProvider = new CActiveDataProvider('Mytest', array(
'criteria' => array(
'condition' => 'type="'.$textdata.'"',
),
));
$bleble = $textdata;
$this->render('Item', array(
'dataProvider' => $dataProvider,
'bleble' => $bleble,
));
}
视图:
$bleble = $bleble;
$this->widget('zii.widgets.grid.CGridView', array(
'id' => 'sample_id',
'dataProvider' => $dataProvider,
'columns' => array(
array(
'header' => 'id',
'name' => 'id',
'value' =>'$data->id',
'type' =>'raw',
"value" => function($data){
echo "text".$data->id;
},
),
NEED !! :
$bleble = $bleble;
$this->widget('zii.widgets.grid.CGridView', array(
'id' => 'sample_id',
'dataProvider' => $dataProvider,
'columns' => array(
array(
'header' => 'id',
'name' => 'id',
'value' =>'$data->id',
'type' =>'raw',
"value" => function($data){
echo $bleble.$data->id;
},
),
错误:
PHP通知 未定义的变量:bleble
需要下载这是我怎么控制器($文本)$文本链接的文本的一个我有写出表格,但当它是一个变量时不起作用,普通文本例如echo“text”。$ data-> id;
仍然不能正常工作, “值”=>函数($数据){ 回声$ bleble $ DATA-> ID; }, 我需要以某种方式交换,这是得到的控制器例如文本显示的方式:TEXT_1,TEXT_2,TEXT_3其中数字表示ID – ubgsdnhfj 2014-10-20 14:06:51