TP5.0Composer安装phpQuery
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": "liu21st@gmail.com" } ], "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" } }
安装 composer require jaeger/querylist
更新 composer update jaeger/querylist
4)引入并测试
<?php namespace appindexcontroller; use QLQueryList; class Index { public function index() { //采集某页面所有的图片 $data = QueryList::Query("http://cms.querylist.cc/bizhi/453.html",["image" => ["img","src"]])->data; //打印结果 print_r($data); } }
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇:没有了
- 下一篇:没有了