我想实现类似Yii CActiveDataProvider解析复杂表达式的方式。以下面的代码为例,我基本上希望能够在值中指定类似'date(“M j,Y”,$ data-> create_time)'“的东西。如何实现Yii CActiveDataProvider解析复杂表达式?
任何人都知道Yii中的哪个班级将提供良好的见解?我看了一下CDataColumn类,但没有多少运气。
$this-widget('zii.widgets.grid.CGridView', array(
'dataProvider'=$dataProvider,
'columns'=array(
'title', // display the 'title' attribute
'category.name', // display the 'name' attribute of the 'category' relation
'content:html', // display the 'content' attribute as purified HTML
array( // display 'create_time' using an expression
'name'='create_time',
'value'='date("M j, Y", $data-create_time)',
),
),
));
看起来像是在这里的答案? http://www.yiiframework.com/doc/api/1.1/CComponent#evaluateExpression-detail – user1693090