标签:
1 function getUri($query){ 2 $request_uri = $_SERVER["REQUEST_URI"]; 3 $url = strstr($request_uri,‘?‘) ? $request_uri : $request_uri.‘?‘; 4 5 if(is_array($query)) 6 $url .= http_build_query($query); 7 else if($query != "") 8 $url .= "&".trim($query, "?&"); 9 10 $arr = parse_url($url); 11 12 if(isset($arr["query"])){ 13 parse_str($arr["query"], $arrs); 14 unset($arrs["page"]); 15 $url = $arr["path"].‘?‘.http_build_query($arrs); 16 } 17 18 if(strstr($url, ‘?‘)) { 19 if(substr($url, -1)!=‘?‘) 20 $url = $url.‘&‘; 21 }else{ 22 $url = $url.‘?‘; 23 } 24 25 return $url; 26 } 27 28 function auto_get($except=array()){ 29 $p_url=$_SERVER[‘QUERY_STRING‘]; 30 parse_str($p_url,$arr); 31 foreach($except as $k=>$v){ 32 if(array_key_exists($v,$arr)){ 33 unset($arr[$v]); 34 } 35 } 36 return http_build_query($arr); 37 }
标签:
原文地址:http://www.cnblogs.com/songzhenghe/p/4568010.html