当前位置:Gxlcms > PHP教程 > php应用xpath抽取网页超链接

php应用xpath抽取网页超链接

时间:2021-07-01 10:21:17 帮助过:26人阅读

php使用xpath抽取网页超链接
loadHTML($html);
$xpath=new DOMXpath($doc);
foreach($xpath->query('//a/@href') as $node){
        $link = $node->nodeValue;
        echo $link . "\n";
}

?>

人气教程排行