更新时间:2023-02-26 13:27:23
首先,正则表达式和HTML不混用。使用:
First of all, regex and HTML don't mix. Use:
foreach(DOMDocument::loadHTML($source)->getElementsByTagName('a') as $a)
{
$a->getAttribute('href');
}
可能在您网站之外的链接以协议或 //
,即
Links that may go outside your site start with protocol or //
, i.e.
http://example.com
//example.com/
href =google.com
是本地文件的链接。
但是如果你想创建一个网站的静态副本,为什么不使用 wget
?
But if you want to create static copy of a site, why not just use wget
?