// 我做了一些更改,但 preg_match 函数不起作用并回显工作。我不明白出了什么问题。我要疯了
public function crawl()
{
$html = $this->getPageHTMLContent($this->getDomain().$this->entryPagePath);
$categoryPageDom = $this->getHtmlDom($html);
echo $categoryPageDom->find('div#pagination a.gh', 1)->attr['href'];
preg_match("/\?p=(.*)&q/", $categoryPageDom->find('div#pagination a.gh', 1)->attr['href'], $machtes);
var_dump($machtes);
}
public function getPageHTMLContent($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$contents = curl_exec ($ch);
curl_close ($ch);
return $contents;
}