• 2
  • 新人请关照

thinkphp5 QueryList4 PhantomJs 网页爬虫报错怎么解决?

代码:

<?php
namespace app\admin\Controller;
use think\Controller;
use app\admin\controller\Check;
use think\Db;
use think\Request;
use QL\QueryList;
use QL\Ext\PhantomJs;
class Grab extends Check {
    
    public function index()
    {
        
        $path = DS. 'public' . DS . 'static' . DS . 'phantomjs';
        $ql = QueryList::getInstance();
        $ql->use(PhantomJs::class,$path);       
        $html = $ql->browser('http://www.ooopic.com/')->getHtml();
        print_r($html);
        
    }


}



报错:

Declaration of JonnyW\PhantomJs\DependencyInjection\ServiceContainer::load() should be compatible with Symfony\Component\DependencyInjection\Container::load($file)
阅读 2k
评论
    2 个回答
    • 190
    \JonnyW\PhantomJs\DependencyInjection\ServiceContainer
    
    public function load($file = null) {}
      • 454
        撰写回答

        登录后参与交流、获取后续更新提醒