控制器:
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
需要下载这就是我控制器链接的文本($文本)$文本是一个我写出来的表,但是当它是一个变量不能正常工作,正常的文字作品,例如回声“文本”。$ DATA-> ID;