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']; } } } } catch (Exception $e) { } return $realurl; }
推荐:微信怎么批量删除聊天记录,彻底删除聊天记录只需这三种方法