Fix the matching exception

Fix the matching exception when the page contains multiple tags prefixed with head (for example: < head >, < header >)
This commit is contained in:
maxiaozhi 2021-07-05 13:51:24 +08:00 committed by GitHub
parent 5953daac54
commit ef0a2efd4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -125,7 +125,7 @@ class Query
*/
public function removeHead()
{
$html = preg_replace('/<head.+?>.+<\/head>/is', '<head></head>', $this->html);
$html = preg_replace('/(<head>|<head\s+.+?>).+<\/head>/is', '<head></head>', $this->html);
$this->setHtml($html);
return $this->ql;
}