关于用php 获取当前脚本的url很多朋友会说很简单,但是要获取很详细的就要经过多次判断哦。
$PHP_TIME = time();
$PHP_SELF = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : (isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : $_SERVER['ORIG_PATH_INFO']);
-
-
-
-
- $PHP_QUERYSTRING = $_SERVER['QUERY_STRING'];
- $PHP_DOMAIN = $_SERVER['SERVER_NAME'];
- $PHP_REFERER = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
- $PHP_SCHEME = $_SERVER['SERVER_PORT'] == '443' ? 'https://' : 'http://'; //测试服务器是否启动了ssl 连接如果是的话。就用https://安全连接来进行通行
- $PHP_PORT = $_SERVER['SERVER_PORT'] == '80' ? '' : ':'.$_SERVER['SERVER_PORT'];
- $PHP_SITEURL = $PHP_SCHEME.$PHP_DOMAIN.$PHP_PORT.PHPCMS_PATH;
- $PHP_URL = $PHP_SCHEME.$PHP_DOMAIN.$PHP_PORT.$PHP_SELF.($PHP_QUERYSTRING ? '?'.$PHP_QUERYSTRING : '');
-
-