轉載自: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;
	}
?>
創作者介紹
創作者 和風信使 的頭像
和風信使

亂貼小站

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