방법 #1
	<?php
	$protocol = stripos($_SERVER['SERVER_PROTOCOL'], 'https') === true ? 'https://' : 'http://';
	?>
	방법 #2
	<?php
	 
	function getSiteProtocol() {
	    if(isset($_SERVER['HTTPS'])  && ($_SERVER['HTTPS'] == 'on' || $_SERVER['HTTPS'] == 1)
	        || isset($_SERVER['HTTP_X_FORWARDED_PROTO']) &&  $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')
	    return $protocol = 'https://';
	    else
	    return $protocol = 'http://';
	}
	 
	?>