Вопрос

Possible Duplicate:
PHP: HTTP or HTTPS? How can one tell?

Is there a way to define this?

$_SERVER superglogal doesn't provide such info. Even only it's ['SERVER_PROTOCOL'] ...

Это было полезно?

Решение

If your request is sent by HTTPS you will have an extra server variable named 'HTTPS'

if( isset($_SERVER['HTTPS'] )  && $_SERVER['HTTPS'] != 'off' ) 
{
   echo 'HTTPS';
}
else
{
  echo 'HTTP';
}
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top