2013-04-17
php相對網址轉絕對網址
相對網址轉絕對網址
function convUrl($url){
$URL_Info = parse_url($url);
if(isset($URL_Info['scheme']))return $url;
if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') {
$output = 'https://';
} else {
$output = 'http://';
}
$url = str_replace('\\','/',$url);
if(!isset($URL_Info['host'])){
if($url{0} == '/'){
$output .= getenv('HTTP_HOST');
}else{
$pnum = substr_count($url,'../');
$url = str_replace('../','',$url);
$path = dirname(getenv('SCRIPT_NAME'));
for($i = 0 ; $i < $pnum; $i++){
$path = substr($path,0,strrpos($path,'/'));
}
$output .= getenv('HTTP_HOST')
.$path
.'/'
;
}
}
return $output.$url;
}
訂閱:
張貼留言 (Atom)
[Unity] Odin Inspector DateTime 時間屬性繪製
Odin Inspector 是一個有名的Unity Inspector Plugin,但沒有為 DateTime 建立可編輯的可視化介面,這邊簡單提供一個可用的方法 。 Odin Inspector 版本 : 3.3.1.14
沒有留言:
張貼留言