Merge pull request #102 from edwinhuish/auto-destroy-phpquery-document

destroy phpquery document object when destruct Query class
This commit is contained in:
Jaeger(黄杰) 2020-03-11 10:29:31 -05:00 committed by GitHub
commit 6ee6a26aee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,6 +15,9 @@ use Closure;
class Query class Query
{ {
protected $html; protected $html;
/**
* @var \phpQueryObject
*/
protected $document; protected $document;
protected $rules; protected $rules;
protected $range = null; protected $range = null;
@ -268,4 +271,15 @@ class Query
} }
return $html; return $html;
} }
}
protected function destroyDocument()
{
$this->document->unloadDocument();
unset($this->document);
}
public function __destruct()
{
$this->destroyDocument();
}
}