PHP는 QueryList를 사용하여 Baidu 네트워크 디스크 리소스 검색 엔진을 쉽게 구현합니다.

藏色散人
풀어 주다: 2023-04-07 17:24:01
앞으로
4717명이 탐색했습니다.

QueryList는 수집을 위해 jQuery를 사용하며 풍부한 플러그인을 갖추고 있습니다.

QueryList가 Baidu 검색 엔진 플러그인을 사용하여 현장 검색을 쉽게 구현하는 방법을 살펴보겠습니다.

Install

Composer를 사용하여 설치:

QueryList 설치

composer require jaeger /querylist

GitHub: https://github.com/jae-jae/Qu...

Baidu 검색 엔진 플러그 설치 -in# 🎜🎜#

composer require jaeger/querylist-rule-baidu

GitHub:

https://github.com/jae-jae/Qu...# 🎜🎜#

Plug-in API

● Baidu Baidu($pageNumber = 10): Baidu 검색 엔진 가져오기

# 🎜🎜#class Baidu :

● Baidu 검색($keyword): 검색 키워드 설정

● Baidu setHttpOpt(array $httpOpt = []): HTTP 옵션 설정, view: #🎜🎜 #GuzzleHttp options

● int getCount(): 검색 결과의 전체 개수를 가져옵니다. ● int getCountPage(): 전체를 가져옵니다. 검색결과 페이지 수 #🎜🎜 #

● 컬렉션 페이지($page = 1,$realURL = false): 검색결과 가져오기

사용

#🎜 🎜#

하나의 Baidu 네트워크 디스크 리소스 검색 엔진을 구현하려면:

<?php
require &#39;vendor/autoload.php&#39;;
use QL\QueryList;
use QL\Ext\Baidu;
$ql = QueryList::use(Baidu::class);
// 搜索百度网盘网站,包含‘百度’关键词的资源
$searcher = $ql->baidu()->search(&#39;site:pan.baidu.com 百度&#39;);
// 获取第一页数据,并获取真实URL连接地址
$data = $searcher->page(1,true);
print_r($data->all());
로그인 후 복사

결과 가져오기:

Array
(
    [0] => Array
        (
            [title] => 百度网盘_享你所想
            [link] => http://pan.baidu.com/
        )
    [1] => Array
        (
            [title] => 百度网盘 客户端下载
            [link] => https://pan.baidu.com/download
        )
    [2] => Array
        (
            [title] => 百度网盘-开放平台
            [link] => https://pan.baidu.com/platform/read
        )
     // ....
)
로그인 후 복사

더 보기 사용법

#🎜 🎜#

$baidu = $ql->baidu(15); // 设置每页搜索15条结果
$searcher = $baidu->search(&#39;QueryList&#39;);
$count = $searcher->getCount();  // 获取搜索结果总条数
$data = $searcher->page(1);
$data = $searcher->page(2);
$searcher = $baidu->search(&#39;php&#39;);
$countPage = $searcher->getCountPage(); // 获取搜索结果总页数
for ($page = 1; $page <= $countPage; $page++)
{
    $data = $searcher->page($page);
}
$data = $searcher->setHttpOpt([
    // 设置http代理
    &#39;proxy&#39; => &#39;http://222.141.11.17:8118&#39;,
   // Set the timeout time in seconds
    &#39;timeout&#39; => 30,
])->page(1);
로그인 후 복사
Google 검색 엔진 플러그인

물론 Baidu 검색 엔진 플러그인 외에도 QueryList 또한 동일한 기능을 수행할 수 있는 Google 검색 엔진 플러그인도 있습니다.

GitHub:

https://github.com/jae-jae/Qu...

PHP 관련 지식을 더 보려면 다음 사이트를 방문하세요.

PHP中文网

!

위 내용은 PHP는 QueryList를 사용하여 Baidu 네트워크 디스크 리소스 검색 엔진을 쉽게 구현합니다.의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

관련 라벨:
원천:segmentfault.com
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
최신 이슈
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!