본문 바로가기
  • AI (Artificial Intelligence)
Programming/PHP

PHP Port를 이용한 제어 방법

by 로샤스 2018. 2. 21.

    /**
* @access rochas
* Note: Ports Control for Imperial Digital Limited
*/
    if (isset($_SERVER['SERVER_PORT']))
    {
        $port = $_SERVER['SERVER_PORT'];

        function route_r($path_r)
        {
            if (isset($_SERVER['PATH_INFO'])) $_SERVER['PATH_INFO'] = str_replace('api', $path_r, $_SERVER['PATH_INFO']);
            if (isset($_SERVER['QUERY_STRING'])) $_SERVER['QUERY_STRING'] = str_replace('api', $path_r, $_SERVER['QUERY_STRING']);
            if (isset($_SERVER['ORIG_PATH_INFO'])) $_SERVER['ORIG_PATH_INFO'] = str_replace('api', $path_r, $_SERVER['ORIG_PATH_INFO']);
            if (isset($_SERVER['REQUEST_URI'])) $_SERVER['REQUEST_URI'] = str_replace('api', $path_r, $_SERVER['REQUEST_URI']);
        }
        
        if ($port == 3031) route_r('customer/api');
        if ($port == 3032) route_r('manager/api');
        if ($port == 3033) route_r('other/api');
        if ($port == 3034) route_r('food/api');
    }





아끕다.. https 때문에 다 소용없게 되어버림..


그래도, 자알~~ 배웠습니다.






댓글