QueryList/src/QueryList.php

56 lines
919 B
PHP
Raw Normal View History

2017-09-19 02:33:38 +08:00
<?php
namespace QL;
use phpQuery;
2017-09-19 17:48:48 +08:00
use QL\Dom\Dom;
2017-09-19 02:33:38 +08:00
/**
* QueryList
*
* 一个基于phpQuery的通用列表采集类
*
* @author Jaeger
* @email JaegerCode@gmail.com
* @link https://github.com/jae-jae/QueryList
* @version 4.0.0
*
*/
class QueryList
{
private $html;
private $document;
/**
* QueryList constructor.
*/
public function __construct()
{
}
/**
* @return mixed
*/
public function getHtml()
{
return $this->html;
}
/**
2017-09-19 17:48:48 +08:00
* @param $html
* @return $this
2017-09-19 02:33:38 +08:00
*/
public function setHtml($html)
{
$this->html = $html;
$this->document = phpQuery::newDocumentHTML($this->html);
return $this;
}
public function find($selector)
{
2017-09-19 17:48:48 +08:00
return (new Dom($this->document))->find($selector);
2017-09-19 02:33:38 +08:00
}
}