开发者

php simple dom parser returning "Array"

<?php
include 'simple_html_dom.php';
$ur开发者_StackOverflow中文版l = 'http://en.wikipedia.org/wiki/Myst';
$html = file_get_html($url);
echo $html->find('body');
?>

This has been returning "Array" on the browser when I try to ONLY get the contents of the body element


Yes, because there may be many elements that fit that selector, so an array of elements is returned. If you only want the first matching element, use $html->find('body', 0). This is all described in the manual: http://simplehtmldom.sourceforge.net/manual.htm


Maybe try

echo $html->find('body', 0);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜