iamcal/pquery
Composer 安装命令:
composer require iamcal/pquery
包简介
A jQuery-style DOM traversal tool, for PHP
README 文档
README
Beware! There are several projects with the name pQuery. You might be looking for a different one.
This PHP library allows you to use jQuery-style selectors to find DOM nodes in HTML documents. It uses the PHP DOM classes under the covers, which ultimately use libxml for document parsing.
Installation
You can install using composer:
composer require iamcal/pquery
This will put the pQuery class into the autoloader in vendor/autoload.php.
Alertnatively you can clone this repo and include src/pQuery.php directly.
Basic Usage
$html = '<p>Hello <b>World</b></p>';
$pq = pQuery::fromHTML($html);
$nodes = $pq->find('b');
// $nodes is an array of DOMNode objects
Supported selectors:
tag
tag.class
tag#id
.class
#id
Selectors can be chained together, e.g. table#my-table th a.info
统计信息
- 总下载量: 56
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-01-22