DOMNode 无法转换为字符串
<?php
// try this html listing example for all nodes / includes a few getElementsByTagName options:
$file = $DOCUMENT_ROOT. "http://website.com";
$doc = new DOMDocument();
@$doc->loadHTMLFile($file);
// example 1:
$elements = $doc->getElementsByTagName('tr');
$album = $elements->item(1);
echo $album;
我如何才能将其转换为可以输出到屏幕的数据?它说我无法转换成字符串。我读到,DOMnode
的功能不像数组,但它创建了 DOMNodeList
。
<?php
// try this html listing example for all nodes / includes a few getElementsByTagName options:
$file = $DOCUMENT_ROOT. "http://website.com";
$doc = new DOMDocument();
@$doc->loadHTMLFile($file);
// example 1:
$elements = $doc->getElementsByTagName('tr');
$album = $elements->item(1);
echo $album;
How am I able to convert this into data that I can output to the screen? It says I cannot convert into a string. I have read that the DOMnode
doesn't function like an array, but it makes a DOMNodeList
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看此页面中的示例
http://www.php.net/manual/ en/domnodelist.item.php
使用
Check out the examples from this page
http://www.php.net/manual/en/domnodelist.item.php
Use