搜索
您的当前位置:首页正文

php获取重定向网址

来源:步旅网

获取重定向之后网址 

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;
    }
}

 

因篇幅问题不能全部显示,请点此查看更多更全内容

Top