Reputation: 19569
I have checked all $_SERVER member var, still don't know how.
Upvotes: 0
Views: 230
Reputation: 11553
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')
// do your stuff here...
Upvotes: 7
Reputation: 43619
$_SERVER['HTTPS']
- from http://php.net/manual/en/reserved.variables.server.php
Set to a non-empty value if the script was queried through the HTTPS protocol.
Note: Note that when using ISAPI with IIS, the value will be off if the request was not made through the HTTPS protocol.
Upvotes: 3
Reputation: 9668
$_SERVER['HTTPS'] == 'on'
upd: and $_SERVER['SERVER_PROTOCOL']
or $_SERVER['SERVER_PORT'] == 443//80 for http
Upvotes: 1