DOCUMENT_ROOT 가 현재 사용자의 경로로 나오지 않는 경우에 대한 수정
This commit is contained in:
@ -66,11 +66,13 @@ $g4 = array();
|
|||||||
|
|
||||||
function g4_path()
|
function g4_path()
|
||||||
{
|
{
|
||||||
$result['path'] = dirname(__FILE__);
|
$result['path'] = str_replace('\\', '/', dirname(__FILE__));
|
||||||
$root = str_replace($_SERVER['DOCUMENT_ROOT'], '', $result['path']);
|
$tilde_remove = preg_replace('/^\/\~[^\/]+(.*)$/', '$1', $_SERVER['SCRIPT_NAME']);
|
||||||
|
$document_root = str_replace($tilde_remove, '', $_SERVER['SCRIPT_FILENAME']);
|
||||||
|
$root = str_replace($document_root, '', $result['path']);
|
||||||
$port = $_SERVER['SERVER_PORT'] != 80 ? ':'.$_SERVER['SERVER_PORT'] : '';
|
$port = $_SERVER['SERVER_PORT'] != 80 ? ':'.$_SERVER['SERVER_PORT'] : '';
|
||||||
$http = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') ? 's' : '') . '://';
|
$http = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') ? 's' : '') . '://';
|
||||||
$user = str_replace(str_replace($_SERVER['DOCUMENT_ROOT'], '', $_SERVER['SCRIPT_FILENAME']), '', $_SERVER['SCRIPT_NAME']);
|
$user = str_replace(str_replace($document_root, '', $_SERVER['SCRIPT_FILENAME']), '', $_SERVER['SCRIPT_NAME']);
|
||||||
$result['url'] = $http.$_SERVER['SERVER_NAME'].$port.$user.$root;
|
$result['url'] = $http.$_SERVER['SERVER_NAME'].$port.$user.$root;
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user