轉載自:Google API 1.7.7

<?php
	function getCurrentUrl() 
	{
	  global $_SERVER;

	  /**
	   * Filter php_self to avoid a security vulnerability.
	   */
	  $php_request_uri = htmlentities(substr($_SERVER['REQUEST_URI'], 0, strcspn($_SERVER['REQUEST_URI'], "\n\r")), ENT_QUOTES);

	  if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') {
		$protocol = 'https://';
	  } else {
		$protocol = 'http://';
	  }
	  $host = $_SERVER['HTTP_HOST'];
	  if ($_SERVER['SERVER_PORT'] != '' &&
		 (($protocol == 'http://' && $_SERVER['SERVER_PORT'] != '80') ||
		 ($protocol == 'https://' && $_SERVER['SERVER_PORT'] != '443'))) {
		$port = ':' . $_SERVER['SERVER_PORT'];
	  } else {
		$port = '';
	  }
	  return $protocol . $host . $port . $php_request_uri;
	}
?>
arrow
arrow
    全站熱搜

    和風信使 發表在 痞客邦 留言(0) 人氣()