这是围绕问题的代码部分
function twitter_count($twitter_id, $widget_id, $clear_cache) {
$twittercount = 0;
if(get_option('twitter_count_' . $widget_id) == 0 || $clear_cache == 'on' || get_option('twitter_count_api_timer_' . $widget_id) < (time() - 1800)):
$followers = $this->curl("http://twitter.com/users/show.xml?screen_name=" . $twitter_id);
try {
if($followers):
$xml = new SimpleXmlElement($followers, LIBXML_NOCDATA);
if($xml):
if((string)$xml->followers_count):
$twittercount = (string)$xml->followers_count;
endif;
update_option('twitter_count_' . $widget_id, $twittercount);
endif;
endif;
} catch(Exception $ex) {}
update_option('twitter_count_api_timer_' . $widget_id, time());
else:
$twittercount = get_option('twitter_count_' . $widget_id);
endif;
return $twittercount;
}
我收到此错误: 解析错误:语法错误,第137行的/home/content/b/r/i/brikrihen/html/brianhenry.com/wordpress/wp-content/themes/StandardTheme_25/lib/followcount.php中的意外“{”
我删除了'{'但仍然收到错误。
我无法理解。
答案 0 :(得分:2)
可能您使用的是旧版本的PHP(例如PHP 4),但尚未支持try
/ catch
。对于PHP,T_STRING
后跟'{'
,这显然会产生解析错误。