我正在尝试使用此代码和php解析外部xml文件,并且simplexml_load_file();
该问题显示$xml->title
为空,它没有任何值,尽管已加载XML文件,
您可以在此链接中看到它http://abone.doganburda.com/test/indexNew.php
<?
$file = 'http://doganburda.com.tr/Files/sonhaber.xml';
if(!$xml = simplexml_load_file($file))
exit('Failed to open '.$file);
$description = $xml2;
echo "Title: " .$xml->title. "<br />" .
"Description: " .$xml->description. "<br />"
?>
您错误地访问了它们。
它应该是
echo $xml->channel->item->title;
echo $xml->channel->item->description;
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句