TP5.0Composer安装phpQuery

TP5.0Composer安装phpQuery

https://blog.csdn.net/hqb421/article/details/77088465

1)安装composer

参照该文档安装composer https://pkg.phpcomposer.com/

2)安装完后进入tp框架的根目录下,在根目录下的composer.json文件中的require中加入QueyListy和扩展如下


"jaeger/querylist": "^3.2",
"jaeger/querylist-ext-request":"^1.0",
"jaeger/querylist-ext-multi":"^1.0",
"jaeger/querylist-ext-login":"^1.0"


{
"name": "topthink/think",
"description": "the new thinkphp framework",
"type": "project",
"keywords": [
"framework",
"thinkphp",
"ORM"
],
"homepage": "http://thinkphp.cn/",
"license": "Apache-2.0",
"authors": [
{
"name": "liu21st",
"email": "[email protected]"
}
],
"require": {
"php": ">=5.4.0",
"topthink/framework": "^5.0",
"jaeger/querylist": "^3.2",
"jaeger/querylist-ext-request":"^1.0",
"jaeger/querylist-ext-multi":"^1.0",
"jaeger/querylist-ext-login":"^1.0"
},
"extra": {
"think-path": "thinkphp"
},
"config": {
"preferred-install": "dist"
}
}


3)这里演示的是windows下安装,命令窗口进入到tp项目的根目录下执行以下命令

安装 composer require jaeger/querylist

更新 composer update jaeger/querylist

4)引入并测试

扫描二维码关注公众号,回复: 4166779 查看本文章

<?php
namespace app\index\controller;

use QL\QueryList;

class Index
{
public function index()
{
//采集某页面所有的图片
$data = QueryList::Query('http://cms.querylist.cc/bizhi/453.html',['image' => ['img','src']])->data;
//打印结果
print_r($data);
}
}

---------------------
作者:HQB421
来源:CSDN
原文:https://blog.csdn.net/hqb421/article/details/77088465
版权声明:本文为博主原创文章,转载请附上博文链接!

猜你喜欢

转载自www.cnblogs.com/sinren/p/9992875.html