时间:2021-07-01 10:21:17 帮助过:16人阅读
ThinkPHP5使用QueryList4教程
几乎每天都有人问我TP5中如何使用QueryList4,所以写了这篇教程。说实话我并不太想写这篇教程,因为实在是没有什么技术含量。
去ThinkPHP官网下载最新的ThinkPHP5框架代码: http://www.thinkphp.cn
在ThinkPHP5代码根目录执行composer命令安装QueryList:
composer require jaeger/querylist
下面演示在Index控制器中使用QueryList:
<?php
namespace app\index\controller;
use QL\QueryList;
class Index
{
    public function index()
    {
       //采集某页面所有的图片
       $data = QueryList::get('http://cms.querylist.cc/bizhi/453.html')->find('img')->attrs('src');
       //打印结果
       print_r($data->all());
    }
}就这样就好了。
PHP7以下环境无法安装和使用QueryList4!
PHP7以下环境无法安装和使用QueryList4!
PHP7以下环境无法安装和使用QueryList4!
如果还是不知道怎么安装的话,可以去QueryList交流群(123266961)中去下载完整的ThinkPHP5集成QueryList4压缩包。
以上就是ThinkPHP5如何使用QueryList4的详细内容,更多请关注gxlcms其它相关文章!