0
我不能在php中用simplexml解析名稱中包含「 - 」的標籤。如何解析名稱中包含' - '的xml標籤?
這是XML的 http://synd.cricbuzz.com/score-gadget/gadget-scores-feed.xml
accoured-未定義的常量文本的 1)使用URL,文字和網址鏈接無法parsed.following錯誤 - 在C假定「文本」:\ WAMP \ www \ score1.php 2)使用未定義的常量鏈接 - 在C:\ wamp \ www \ score1.php中假定爲'link'3)2)使用未定義的常量鏈接 - 在C:\ wamp中假定'url' \ www \ score1.php plz help me php正在解析url-text作爲分隔變量 - 「url」和「text」
這是t他的代碼
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Pragma: no-cache"); Header('Pragma: no-cache');
$url = "http://synd.cricbuzz.com/score-gadget/gadget-scores-feed.xml";
//$url = "C:\wamp\www\score.xml";
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec ($curl);
curl_close ($curl);
print $result;
$fp = fopen('score.xml', 'w');
if($fp)
fwrite($fp, $result);
else
echo "Error !";
$url = "score.xml";
$xml = simplexml_load_file($url,null, LIBXML_NOCDATA);
foreach ($xml->match as $xmlinfo):
$header=$xmlinfo->header;
$description=$xmlinfo->description;
$urltext=$xmlinfo->url-text;
$urllink=$xmlinfo->url-link;
echo $header,$description,$urltext;
endforeach;
//var_dump($xml);
?>