2017-07-13 84 views

回答

1

嘗試下面的代碼:

$x = new SimpleXmlElement($str); 
$x->registerXPathNamespace('content', 'http://purl.org/rss/1.0/modules/content/'); 

$result = $x->xpath('//channel/item/content:encoded'); 
if(count($result) > 0) { 
    foreach($result as $element) { 
     echo (string)$element . "\n"; 
    } 
} 
+0

越來越這在$結果:https://pasteboard.co/GAIlxBV.png – EugenA

+0

你應該循環這個'$結果'並投入像我爲第0個元素的字符串。 –

+0

我更新了代碼,使用更新後的代碼。 –