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;
}
}这个函数可以获取重定向后的地址,但是如果这个地址经过多次重定向的话,怎样才能获得最终地址呢?重定向