ok
This commit is contained in:
parent
8bd07f5fbb
commit
02fe5a7f9e
@ -4,9 +4,9 @@
|
||||
"keywords":["QueryList","phpQuery","spider"],
|
||||
"homepage": "http://querylist.cc",
|
||||
"require": {
|
||||
"PHP":">=5.6.0",
|
||||
"PHP":">=7.0",
|
||||
"jaeger/phpquery-single": "^0.9",
|
||||
"illuminate/support": "^5.5"
|
||||
"tightenco/collect": "^5.5"
|
||||
},
|
||||
"suggest":{
|
||||
"monolog/monolog":"Log support"
|
||||
@ -22,5 +22,8 @@
|
||||
"psr-4":{
|
||||
"QL\\":"src"
|
||||
}
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/var-dumper": "^3.3"
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ class QueryList
|
||||
protected $document;
|
||||
protected $rules;
|
||||
protected $range = null;
|
||||
protected $encoder;
|
||||
|
||||
/**
|
||||
* QueryList constructor.
|
||||
@ -88,10 +89,9 @@ class QueryList
|
||||
$robj = pq($document)->find($this->range);
|
||||
$i = 0;
|
||||
foreach ($robj as $item) {
|
||||
while (list($key, $reg_value) = each($this->rules)) {
|
||||
$tags = isset($reg_value[2])?$reg_value[2]:'';
|
||||
foreach ($this->rules as $key => $reg_value){
|
||||
$tags = $reg_value[2] ?? '';
|
||||
$iobj = pq($item)->find($reg_value[0]);
|
||||
|
||||
switch ($reg_value[1]) {
|
||||
case 'text':
|
||||
$data[$i][$key] = $this->allowTags(pq($iobj)->html(),$tags);
|
||||
@ -108,13 +108,11 @@ class QueryList
|
||||
$data[$i][$key] = call_user_func($reg_value[3],$data[$i][$key],$key);
|
||||
}
|
||||
}
|
||||
//重置数组指针
|
||||
reset($this->rules);
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
while (list($key, $reg_value) = each($this->rules)) {
|
||||
$tags = isset($reg_value[2])?$reg_value[2]:'';
|
||||
foreach ($this->rules as $key => $reg_value){
|
||||
$tags = $reg_value[2] ?? '';
|
||||
$lobj = pq($document)->find($reg_value[0]);
|
||||
$i = 0;
|
||||
foreach ($lobj as $item) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user