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


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 行(从项目开始)

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

        ));
        ?> 
这是因为

您在以下行中使用了匿名函数

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

此功能从PHP版本 5.3 及更高版本开始可用。因此,您需要将服务器的PHP版本升级到 + 5.3,否则不应使用匿名函数。