//安裝QueryList
composer require jaeger/querylist<?phpinclude './vendor/autoload.php';
// 使用composer安裝后引入目錄
use QL\QueryList;
// 使用插件
$html = file_get_contents('https://www.biqudu.com/14_14778/');
// 手動獲取頁面
$data = QueryList::html($html);
// 得到頁面內容
$data = QueryList::setHtml('https://www.biqudu.com/14_14778/');
// 等同于上面的
html()$data->rules([ // 采集所有a標簽的href屬性
'link' => ['a','href'],
// 采集所有a標簽的文本內容
'text' => ['a','text'] ]);
// 此處$data = 上面已經獲取到網頁內容之后的物件
// 設定采集規則/ 替代了傳統正則
$data->query();
// 此處$data = 上面已經獲取到網頁內容之后的物件
// query 執行操作$data->getData();
// 此處$data = 上面已經獲取到網頁內容之后的物件
// 得到資料結果
$data->all();// 此處
$data = 上面已經獲取到網頁內容之后的物件// 將資料轉換成二維陣列
print_r($data->all());// 列印結果
本文轉載于https://blog.csdn.net/qq_39191303/article/details/82894334?utm_source=app
如有冒犯,請聯系qq861337504洗掉!
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/245640.html
標籤:其他
上一篇:采用KubeSphere的kk,部署安裝多節點服務的kubernetes-v1.18.6和kubesphere-v3.0.0的踩坑程序記錄,及反思
下一篇:2021-01-06
