有人可以帮助我吗,现在尝试修复此错误几个小时,但似乎不知道如何解决
解析错误:解析错误,意外的 T_OBJECT_OPERATOR,期待 ')'
oreach ($doc->getElementsByTagName('item') as $node) {
if ($counter <= $limit)
{
$items = array ('title' => $node->getElementsByTagName('title')->item(0)->nodeValue,'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,'description' => $node->getElementsByTagName('description')->item(0)->nodeValue,'pubDate' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue);
array_push($feeds, $items);
}
$counter++;
}
echo '
<ul id="facebook">';
foreach ($feeds as $feed)
{
$date = strtotime($feed['pubDate']);
echo '
<li>';
echo '<div class="blog_box">
<div class="grid_2">
<h4>'. date('jS F Y G:H' ,$date) .'</h4>
</div>
<div class="grid_6">
<h1><a href="'. $feed['link'] .'" title="'.$feed['title'].'">'.$feed['title'].'</a></h1>
<p>'.$feed['description'].'</p>
</div>
<div align="right">
<a href="'. $feed['link'] .'" class="button minimal small" title="News link">Read More</a>
</div>
<div class="clearnospacing"></div>
</div>
';
echo '</li>
';
}
echo '</ul>
';
我得到的错误是
$items = array ('title' => $node->getElementsByTagName('title')->item(0)->nodeValue,'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,'description' => $node->getElementsByTagName('description')->item(0)->nodeValue,'pubDate' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue);