开发者

Facebook Graph Throwing Error on Server, Fine on localhost

I'm using the new facebook graph API and getting an odd error when I push to a web server.

My Code is pretty simple with fbmain.php calling facebook.php

<?php
include_once "fbmain.php";


$ab = $facebook->api('/cocacola/feed');
 echo ($ab['data']['0']['message']);

When I run this locally, it works great without any errors.

When I run it on my server, I get the error:

Parse error: parse error, 开发者_StackOverflow中文版unexpected '{' in /home/content/w/e/s/wesbos/html/clients/audiobooks/wp-content/themes/ab/fb/fbmain.php  on line 6

The part of fbmain.php its saying is causing the problem is :

    try{
    include_once "facebook.php";
}

Any idea why this wouldn't work on my server?


Turned out I was running PHP 4.x and try{} was only introduced in php5. Problem solved.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜