function getrealurl($url){
$realurl = $url;
try {
$headers = get_headers($realurl, true);
if(isset($headers['Location'])){
if(is_array($headers['Location'])){
$location = '';
for($i=count($headers['Location']); $i>0; $i--){
$location = $headers['Location'][$i-1] . $location;
if (preg_match("/^(http|https)\:\/\//i", $location)) {
break;
}
}
$realurl = $location;
}else{
if (!preg_match("/^(http|https)\:\/\//i", $headers['Location'])) {
$realurl .= $headers['Location'];
}else{
$realurl = $headers['Location'];
}
}
}
} catch (Exception $e) {
}
return $realurl;
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。