龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > php编程 >

php获取网页301真实地址

时间:2014-07-22 14:50来源: 作者: 点击:
分享到:
a href=http://qita.in/bMv target=_blank rel=nofollowimg alt=填写您的邮件地址,订阅我们的精彩内容: src=http://static.oschina.net/uploads/img/201302/16195715_kPci.png //a转载地址: a href=http://blog.qita.in/?post=342
填写您的邮件地址,订阅我们的精彩内容:转载地址: http://blog.qita.in/?post=342
function getrealurl($url){
	$header = get_headers($url,1);
	if (strpos($header[0],'301') || strpos($header[0],'302')) {
		if(is_array($header['Location'])) {
			return $header['Location'][count($header['Location'])-1];
		}else{
			return $header['Location'];
		}
	}else {
		return $url;
	}
}
精彩图集

赞助商链接