2012-08-30 5 views
-2

가능한 중복 :
How To Find Out If You are Using HTTPS Without $_SERVER['HTTPS']
PHP Get Site URL Protocol - http vs httpsPHP에서 프로토콜을 얻는 방법?

어떻게 PHP에서 프로토콜을받을 수 있나요?

$_SERVER['SERVER_PROTOCOL'] 

은 내가 HTTP/1.1을 보여 주지만 http 또는 https를 반향하는 방법이 있습니까? 당신이 정말로 단지를 활성화 할 HTTPS를 알고 싶은 경우에

+0

http://stackoverflow.com/questions/5013633/identify-whether-the-current-url-is-http-or-https-in-a-project?rq=1 – PeeHaa

+0

에 http : // portoverflow.com/questions/7431313/php-getting-full-server-name-including-port-number-and-protocol – PeeHaa

답변

0
$protocol = current(explode('/',$_SERVER['SERVER_PROTOCOL'])); 

, 당신은 단지 $_SERVER['HTTPS']를 사용할 수 있습니다.

0
list($protocol) = explode("/",$_SERVER['SERVER_PROTOCOL']); 
관련 문제