【发布时间】:2011-10-13 12:23:33
【问题描述】:
我正在使用这个库(PHP Simple HTML DOM parser)来解析链接,代码如下:
function getSemanticRelevantKeywords($keyword){
$results = array();
$html = file_get_html("http://www.semager.de/api/keyword.php?q=". urlencode($keyword) ."&lang=de&out=html&count=2&threshold=");
foreach($html->find('span') as $e){
$results[] = $e->plaintext;
}
return $results;
}
但是当我输出结果时出现这个错误:
致命错误:在非对象上调用成员函数 find() /var/www/vhosts/e着名的.de/subdomains/sandbox/httpdocs/getNewTrusts.php 第 25 行
(第 25 行是 foreach 循环),奇怪的是它正确地输出了所有内容(至少看起来如此),但我仍然收到该错误并且无法弄清楚原因。
【问题讨论】:
标签: php html-parsing