Facebook 图表在服务器上抛出错误,在本地主机上正常
我正在使用新的 facebook 图形 API,当我推送到网络服务器时出现奇怪的错误。
我的代码非常简单, fbmain.php 调用 facebook.php
<?php
include_once "fbmain.php";
$ab = $facebook->api('/cocacola/feed');
echo ($ab['data']['0']['message']);
当我在本地运行它时,它工作得很好,没有任何错误。
当我在服务器上运行它时,出现错误:
Parse error: parse error, unexpected '{' in /home/content/w/e/s/wesbos/html/clients/audiobooks/wp-content/themes/ab/fb/fbmain.php on line 6
fbmain.php 的部分内容导致问题是:
try{
include_once "facebook.php";
}
知道为什么这在我的服务器上不起作用吗?
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, 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
结果我运行的是 PHP 4.x,而 try{} 仅在 php5 中引入。问题解决了。
Turned out I was running PHP 4.x and try{} was only introduced in php5. Problem solved.