【发布时间】:2011-01-17 08:48:12
【问题描述】:
我正在尝试使用 PHP Simple HTML DOM Parser 选择一个类或一个 ID,但绝对没有运气。我的示例非常简单,似乎符合手册中给出的示例(http://simplehtmldom.sourceforge.net/manual.htm),但它不起作用,它让我陷入困境。使用简单 dom 给出的其他示例脚本工作正常。
<?php
include_once('simple_html_dom.php');
$html = str_get_html('<html><body><div id="foo">Hello</div><div class="bar">Goodbye</div></body></html>');
$ret = $html->find('.bar')->plaintext;
echo $ret;
print_r($ret);
谁能看出我哪里出错了?
【问题讨论】: