我在行中遇到错误$ x = $ x-> firstChild-> textContent;显示没问题,但通知错误显示,如何摆脱这个通知错误?我刚刚从rss feed中获取了这段代码。我不确切知道发生了什么。
<?php
$Universal_Style = "p"; // replace that by span class="" to custom
$Universal_Date_Font = "size='-1'";
$Universal_FeedArray = array();
$Universal_AtomChannelTags = array("title","link","subTitle","updated");
$Universal_AtomItemTags = array("title","link","summary","pubDate");
$Universal_RssChannelTags = array("title","link","description","lastBuildDate");
$Universal_RssItemTags = array("title","link","description","pubDate");
$Universal_Translation = array("title"=>"title",
"link"=>"link",
"description"=>"description",
"subTitle"=>"description",
"summary"=>"description",
"lastBuildDate"=>"updated",
"pubDate"=>"updated");
$Universal_Doc = false;
/**
* Read the content of a tag
* Input:
* - element: the node
* - tag: the name of the tag
* Ouput:
* - the content
*/
function getTag($element, $tag)
{
$x = $element->getElementsByTagName($tag);
if($x->length == 0)
{
return false;
}
$x = $x->item(0);
$x = $x->firstChild->textContent;
return $x;
}
?>