文件包含:
<a href="site.com/" h="
<a href="site3.com/" h="
所以我想通过 preg_grep 或 preg_match 模式回显所有网址?
在 href=" 和 " 之间获取所有内容的模式
谢谢 !
文件包含:
<a href="site.com/" h="
<a href="site3.com/" h="
所以我想通过 preg_grep 或 preg_match 模式回显所有网址?
在 href=" 和 " 之间获取所有内容的模式
谢谢 !
这是一个如何使用DOMDocument的示例
$html = '
<a href="site.com/">link1</a>
<a href="site3.com/">link2</a>
';
$dom = new DOMDocument();
$dom->loadHTML($html);
$links = $dom->getElementsByTagName('a');
foreach($links as $link) {
echo $link->getAttribute('href');
}
在php.net上查看另一个示例