g5_url 은 어떻게 정의 되나요?
본문
g5_url 이 그누보드 루트 디렉토리인데
이게 어떻게 정의되는 건가요?
답변 2
common.php 파일 30번재줄 라인부터 아래 코드가 있습니다.
function g5_path()
{
$result['path'] = str_replace('\\', '/', dirname(__FILE__));
$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'] : '';
$http = 'http' . ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on') ? 's' : '') . '://';
$user = str_replace(str_replace($document_root, '', $_SERVER['SCRIPT_FILENAME']), '', $_SERVER['SCRIPT_NAME']);
$host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
if(isset($_SERVER['HTTP_HOST']) && preg_match('/:[0-9]+$/', $host))
$host = preg_replace('/:[0-9]+$/', '', $host);
$host = preg_replace("/[\<\>\'\"\\\'\\\"\%\=\(\)\/\^\*]/", '', $host);
$result['url'] = $http.$host.$port.$user.$root;
return $result;
}
$g5_path = g5_path();
현재 파일위치와 서버에서 제공해주는 정보들을 가지고서
config.php 파일에서 G5_URL 와 G5_PATH 로 나누어 줍니다.
!-->www/config.php 파일에 있습니다
답변을 작성하시기 전에 로그인 해주세요.