WebServer(实时服务器)上的解析错误,本地机器上没有解析错误

Parsing Error on WebServer (live Server) and no Parsing Error on Local Machine

我在本地机器上开发并测试了一个应用程序..一切正常! 当我将其迁移到实时服务器时,我不断收到所有解析错误!! 例如

不知道下面的代码有什么错误?

Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /home/content/index.php on line 126

第126行是下面的第3行(从items开始)

<?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()),


        ));
        ?> 

这是因为您在下一行中使用了 anonymous function:

'items'=>array_map(function($record){
      return array(
      ...

此功能从 PHP 版本 5.3 及更高版本开始提供。所以你需要升级你的服务器的 PHP 版本到 +5.3 或者你不应该使用匿名函数。