本文介绍了DOMDocument 简单的 GetElementsByTagName 不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$loadgetElementsByTagName('stw:Thumbnail')->item(0)->nodeValue;$status = $dom->getElementsByTagName('stw:Thumbnail')->item(0)->nodeValue;回声 $result;
上面的代码应该输出 http://imagelink.com 并且 $status 应该保持delivered"——但没有在这些工作中,我留下了错误通知:
试图获取非对象的属性
我尝试了不同的
如何获取 stw:Thumbnail 中的值?
解决方案
使用简单的 ->children() 方法:
$children('stw', 'http://www.shrinktheweb.com/doc/stwresponse.xsd');echo '';foreach($stw as $e) {打印_r($e);//在这里做你必须做的事}
$
Having the above code should output http://imagelink.com and $status should hold "delivered" - but none of these work instead I am left with the error notice that:
Trying to get property of non-object
I have tried different
How can i get the values inside stw:Thumbnail?
解决方案
Using simple ->children() method on this one:
$
这篇关于DOMDocument 简单的 GetElementsByTagName 不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!