douhan9748 2015-01-01 22:16
浏览 15
已采纳

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

I developed and tested an application on my local machine.. everything works perfectly! When I migrated this to a live server I keep getting all the parsing errors!! For e.g

I don't know what is the error on the following code?

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

Line 126 is line 3 (starting from items) below

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


        ));
        ?> 
  • 写回答

1条回答 默认 最新

  • dream518518518 2015-01-01 23:40
    关注

    This is because of you are using anonymous function in below line:

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

    This feature is available as of PHP version 5.3 and above. So you need to upgrade your server's PHP version to +5.3 or you should not use anonymous functions.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度