0
$file = simplexml_load_file($url); {
foreach($file->entry as $post) {
$row = simplexml_load_string($post->asXML()); // after adding this line, i get error message
$links = $row->xpath('//link[@rel="alternate" and @type="text/html"]');
echo (string) $post->title;
echo (string) $links[0]['href'];
我使用此腳本來解析原子提要。起初沒有工作,因爲它無法正確傳遞鏈接的href屬性。我添加了$row
,即使它工作,它也會提供一個錯誤:「沒有定義條目上的etag的名稱空間前綴gd」。我正在尋找這個小時,找不到解決方案。我很親密。xml解析錯誤,使用php的asxml()