我有这个PHP脚本很好地转换几乎所有页面很好但在少数页面它无法将相对URL转换为绝对url.it给下面的链接错误的结果。
$url = 'http://www.lowridermagazine.com/girls/1201_lrms_cat_cuesta_lowrider_girls_model/photo_01.html';
// Example of a relative link of the page above.
$relative = 'photo_01.html';
// Parse the URL the crawler was sent to.
$url = parse_url($url);
if(FALSE === filter_var($relative, FILTER_VALIDATE_URL))
{
// If the link isn't a valid URL then assume it's relative and
// construct an absolute URL.
print $url['scheme'].'://'.$url['host'].'/'.ltrim($relative, '/');
}
else
{
$relative;
}
它适用于http://www.santabanta.com/photos/shriya/9830084.htm网址但在上面的网址中失败了。 任何想法,我在做错误