php获取网页301真实地址
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

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; } }
- 上一篇:自动转换字符集 支持数组转换
- 下一篇:防止外部提交表单|禁止跨站提交
精彩图集
精彩文章