0

我正在显示我的 Eventbrite 帐户中的事件列表,并且在本地运行时,它可以工作。当我将它上传到我的实时测试站点时,它会触发:

解析错误:语法错误,意外的 T_FUNCTION in ... 在线 ...

我的 PHP 如下,几乎一字不差来自https://github.com/ryanjarvinen/eventbrite.php/blob/master/examples/event-list-example.md

<?php
include "Eventbrite.php";
$authentication_tokens = array('app_key'  => 'XXXXXXXX',
                           'user_key' => '123456789');
$eb_client = new Eventbrite( $authentication_tokens );

$events = $eb_client->user_list_events();

$custom_render_function = function($evnt){
$time = strtotime($evnt->start_date);
    if( isset($evnt->venue) && isset( $evnt->venue->name )){ 
        $venue_name = $evnt->venue->name;
    }else{
        $venue_name = 'online';
    }   
$event_html = "<div class='eb_event_list_item' id='evnt_div_" . $evnt->id ."'>
                    <span class='eb_event_list_date'>" . strftime('%a, %B %e', $time) . "</span>
                    <a class='eb_event_list_title' href='" . $evnt->url."'>".$evnt->title."</a>
                    <span class='eb_event_list_time'>" . strftime('%l:%M %P', $time) . "</span>
                    <span class='eb_event_list_location'>" . $venue_name . "</span>
                </div>\n";
return $event_html;
}

?>

<?= $event_list_html = Eventbrite::eventList( $events, $custom_render_function); ?>

谁能帮我看看我哪里出错了?

更新: 这是服务器上的 PHP 版本(5.3)。我的必须由托管服务更新,但只用了 30 秒,这个问题就解决了。

4

0 回答 0