致命错误函数名称必须是字符串24

时间:2012-12-23 22:40:28

标签: string php

我在linux服务器上收到此错误

  

致命错误:函数名称必须是字符串   第24行/home/calaniz1/public_html/system/get_answers.php

function print_answers($dom){

$endl = "<br />";
$html = file_get_dom($dom);
$s=2;
$answer = array();
$answer_id = array();
$count_total = 0;
$count_index = 0;
$errflag = false;
foreach ($html('.closed') as $div) {
    foreach ($div('select') as $ab){    
        $id = $ab->name;
        $count_total ++ ;
        $count_index = $count_total -1 ;
        $answer_id[$count_index] = $id;
        $answer[$count_index] = $ab->onmouseover;
    }

但是在我的电脑里我没有错误......

1 个答案:

答案 0 :(得分:1)

我猜file_get_dom()会返回一个闭包/匿名函数,甚至是一个array($object, $methodName)的数组。第一个是PHP5.3,第二个是PHP5.4。不管怎样,或者你做的事情完全错了。

经过简短的研究后,http://simplehtmldom.sourceforge.net/ $html应该是一个对象,您要找的是$html->find('.closed')

错误的图书馆,关于这一点的评论:http://code.google.com/p/ganon/ 不好,当所有内容都使用相同的标识符而没有命名空间时;)