- 普通 - 未处理
因为$_SERVER['HTTPS'] == 'on' 会报 no index的错误,看了网上的,原因是不是每个服务器下都会返回这个,就会有个出错提示就添加了个判断 page is in https mode 的函数就可以消除这个错误提示了.
function getSiteUrl() {
$local_path = dirname($_SERVER['SCRIPT_NAME']);
//Note that when using ISAPI with IIS, the value will be off if the request was not made through the HTTPS protocol.
$uri = 'http'.(in_https_mode() ?'s':'').'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
return substr($uri,0,strpos($uri,$local_path)+strlen($local_path));
}
/**
* Page is in https mode
* return true or false
*/
function in_https_mode()
{
if (isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']))
{
return TRUE;
}
return FALSE;
}