我有一個客戶需要緊急的網站,但我無法訪問控制面板等信息。PHP解析錯誤在rss解析功能
PHP版本是4.4這是因爲我已經習慣了5
第一個問題是我不斷收到一個痛:
Parse error: parse error, unexpected T_OBJECT_OPERATOR, expecting ')' in D:\hshome\*******\********\includes\functions.php on line 37
這是有問題的功能:
function read_rss($display=0,$url='') {
$doc = new DOMDocument();
$doc->load($url);
$itemArr = array();
foreach ($doc->getElementsByTagName('item') as $node) {
if ($display == 0) {
break;
}
$itemRSS = array(
'title'=>$node->getElementsByTagName('title')->item(0)->nodeValue,
'description'=>$node->getElementsByTagName('description')->item(0)->nodeValue,
'link'=>$node->getElementsByTagName('link')->item(0)->nodeValue);
array_push($itemArr, $itemRSS);
$display--;
}
return $itemArr;
}
,問題中的一行:
'title'=>$node->getElementsByTagName('title')->item(0)->nodeValue,
請將您的兩個問題分爲兩個問題。數據庫中沒有即將出現的短缺),而且很可能有人會回答你的問題。 – Piskvor 2010-08-26 17:02:34