如何解决php中的致命错误

时间:2015-01-31 13:24:13

标签: php fatal-error

在本地主机上运行代码时,显示错误 -

( ! ) Fatal error: Call to a member function find() on a non-object in 
C:\wamp\www\crawler_based_search_engine\ajax_requests.php on line 130

调用堆栈

#   Time    Memory  Function    Location
1   0.0151  162928  {main}( )   ..\ajax_requests.php:0

第130行及以后的代码如下

            $html = file_get_html($file_name);
            // Find all links 
            foreach($html->find('a') as $element) //--this is line no 130
            {
                $url = $element->href;
                $index = strpos($url,'q=https://');
                if($index > 0)
                {
                    $index2 = strpos($url,'webcache');
                    if($index2 === false)
                    {
                        $index2 = strpos($url,'sa=U');
                        $url = substr($element->href,$index+2,$index2-$index-3);
                        echo "<a href='$url'>$url</a>";
                        echo '<hr/>';
                    }
                }
            }

由于此错误,我的程序没有从谷歌

获取链接

0 个答案:

没有答案