我在我的本地机器上开发并测试了一个应用程序......一切都很完美! 当我将其迁移到实时服务器时,我不断收到所有解析错误! 例如
我不知道以下代码的错误是什么?
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /home/content/index.php on line 126
第126行是
下面的第3行(从项目开始)<?php
$this->widget('bootstrap.widgets.TbCarousel',
array(
'items'=>array_map(function($record){
return array(
'image' => Yii::app()->baseUrl.'/'.CHtml::encode($record['file_location']),
'label'=>$this->renderPartial("_frontlabel",array('record'=>$record),true),
'imageOptions'=>array('style'=>'height: auto; max-height: 1000px; overflow:auto; max-width: 900px;margin-bottom: 0 auto;'),
'itemOptions' => array('class'=>'carousel-inner','style'=>'height:800px;margin-top:0px;margin-left:0px'),
'captionOptions'=>array('style'=>'background: none repeat scroll 0 0 rgba(0, 0, 0, 0.4);'),
'caption'=>$this->renderPartial("_frontCaptionContent",array('record'=>$record,'cc'=>new ECurrencyHelper()),true),
);
},$dataProvider->getdata()),
));
?>
答案 0 :(得分:0)
这是因为你在下面的行中使用 anonymous function :
'items'=>array_map(function($record){
return array(
...
此功能自PHP
版本5.3
及更高版本开始提供。因此,您需要将服务器的PHP
版本升级到+ 5.3
,否则您不应使用匿名函数。