array(
'name'=>'user_id',
'value'=>'$data->user_id==-1 ? "无" : CHtml::link("xx")',
),
这种写法有错,请问大家还有什么办法吗?如果代码改为
$data->user_id==-1 ? "无" : "xx" 这样子就没错
array(
'name'=>'user_id',
'value'=>'$data->user_id==-1 ? "无" : CHtml::link("xx")',
),
这种写法有错,请问大家还有什么办法吗?如果代码改为
$data->user_id==-1 ? "无" : "xx" 这样子就没错
还有类似如下
array(
'class'=>'CButtonColumn',
'template'=>'{delete} <br />{copyUrl}',
'buttons'=>array(
'copyUrl'=>array(
'label'=>'复制',
'click'=>'js:function(){copy2Clipboard("$data->getImageUrl(null)")}',
),
),
),
现在$data数据使用不起来,请教大家了,谢谢~
是什么错误呢?
第一个错误如下:
PHP Error
描述
include($data->user_id? "无" : CHtml.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory
源文件
E:\htdocs\lib\yii2\framework\YiiBase.php(338)
00326: * @param string class name
00327: * @return boolean whether the class has been loaded successfully
00328: */
00329: public static function autoload($className)
00330: {
00331: // use include so that the error PHP file may appear
00332: if(isset(self::$_coreClasses[$className]))
00333: include(YII_PATH.self::$_coreClasses[$className]);
00334: else if(isset(self::$_classes[$className]))
00335: include(self::$_classes[$className]);
00336: else
00337: {
00338: include($className.'.php');
00339: return class_exists($className,false) || interface_exists($className,false);
00340: }
00341: return true;
00342: }
第二个问题,是我buttons里的click方法,不知道怎么引用$data这个变量,像我那样写,根本不起作用,当字符串输出了
顶一下