- 浏览: 90232 次
- 性别:
- 来自: 厦门
文章分类
- 全部博客 (91)
- 测试 (0)
- 其他 (0)
- cms (3)
- 配置apache虚拟主机 (1)
- 搜索引擎seo (3)
- php (24)
- html (6)
- thinkphp (3)
- jquery (10)
- ajax (1)
- css (2)
- javascript (4)
- it (5)
- mysql数据库 (10)
- dedecms (2)
- smarty (2)
- powerdesigner教程 (1)
- Query选项卡 (1)
- ckeditor (1)
- http (1)
- 求助 (1)
- 免费域名 (1)
- 网站挂马检测 (1)
- 软件软件软件 (1)
- WordPress主题制作 (1)
- zencart.me (9)
- zencart购物车修改调用显示购物车图片 (1)
- 修改边栏购物车模版 (1)
- html5 (2)
- seo (5)
- zen cart商品无限分级类别递归 (1)
- zencart教程 (2)
- 在浏览器 favicon 上显示进度 很帅 很酷 (1)
- html5实现太阳系星球演示效果 (1)
- 各地程序员的特征,请对号入座 (1)
- magento的系统需求 (1)
- ubuntu (1)
- 免费空间 (0)
- 哪里有免费发布广告外链 (0)
- 熊猫烧香源代码 (1)
- mysql (0)
- opencart (1)
最新评论
php$_SERVER[’PHP_SELF’], $_SERVER['REQUEST_URI'], and $_SERVER[’SCRIPT_NAME’]区别
$_SERVER[PHP_SELF], $_SERVER[SCRIPT_NAME], $_SERVER['REQUEST_URI'] 在用法上是非常相似的,他们返回的都是与当前正在使用的页面地址有关的信息,这里列出一些相关的例子,帮助确定哪些是在你的脚本最适合的。
$_SERVER[’PHP_SELF’]http://www.fenge8.cn/example/ — – — /example/index.php
http://www.fenge8.cn/example/index.php — – — /example/index.php
http://www.fenge8.cn/example/index.php?a=test — – — /example/index.php
http://www.fenge8.cn/example/index.php/dir/test — – — /dir/test
当我们使用$_SERVER['PHP_SELF']的时候,无论访问的URL地址是否有index.php,它都会自动的返回 index.php.但是如果在文件名后面再加斜线的话,就会把后面所有的内容都返回在$_SERVER['PHP_SELF']。
$_SERVER['REQUEST_URI']
http://www.fenge8.cn/example/ — – — /
http://www.fenge8.cn/example/index.php — – — /example/index.php
http://www.fenge8.cn/example/index.php?a=test — – — /example/index.php?a=test
http://www.fenge8.cn/example/index.php/dir/test — – — /example/index.php/dir/test
$_SERVER['REQUEST_URI']返回的是我们在URL里写的精确的地址,如果URL只写到”/”,就返回 “/”
$_SERVER['SCRIPT_NAME']
http://www.fenge8.cn/example/ — – — /example/index.php
http://www.fenge8.cn/example/index.php — – — /example/index.php
http://www.fenge8.cn/example/index.php — – — /example/index.php
http://www.fenge8.cn/example/index.php/dir/test — – — /example/index.php
在所有的返回中都是当前的文件名/example/index.php
$_SERVER[’PHP_SELF’]http://www.fenge8.cn/example/ — – — /example/index.php
http://www.fenge8.cn/example/index.php — – — /example/index.php
http://www.fenge8.cn/example/index.php?a=test — – — /example/index.php
http://www.fenge8.cn/example/index.php/dir/test — – — /dir/test
当我们使用$_SERVER['PHP_SELF']的时候,无论访问的URL地址是否有index.php,它都会自动的返回 index.php.但是如果在文件名后面再加斜线的话,就会把后面所有的内容都返回在$_SERVER['PHP_SELF']。
$_SERVER['REQUEST_URI']
http://www.fenge8.cn/example/ — – — /
http://www.fenge8.cn/example/index.php — – — /example/index.php
http://www.fenge8.cn/example/index.php?a=test — – — /example/index.php?a=test
http://www.fenge8.cn/example/index.php/dir/test — – — /example/index.php/dir/test
$_SERVER['REQUEST_URI']返回的是我们在URL里写的精确的地址,如果URL只写到”/”,就返回 “/”
$_SERVER['SCRIPT_NAME']
http://www.fenge8.cn/example/ — – — /example/index.php
http://www.fenge8.cn/example/index.php — – — /example/index.php
http://www.fenge8.cn/example/index.php — – — /example/index.php
http://www.fenge8.cn/example/index.php/dir/test — – — /example/index.php
在所有的返回中都是当前的文件名/example/index.php
发表评论
-
PHP非诚勿扰-我不是“拍黄片”的!
2013-03-03 14:56 1230非诚勿扰 PHP程序员一场全部灭灯,可怜的,我是PHP程序员 ... -
php输出正立金字塔
2013-01-24 21:05 942php输出正立金字塔 <?php $a = ... -
php永远不懂的面试题目1算出两个文件的相对路径
2012-08-22 10:45 741新浪有个面试题目:写一个php函数算出两个文件的相对路径 ? ... -
http伪静态 htaccess 配置文件详解
2012-08-16 13:57 954.htaccess 配置文件详解 .htaccess文件设置基 ... -
几行 PHP 代码就可以禁用凡人的 HTTP 缓存
2012-08-16 13:53 694header("Content-Type: appl ... -
php ckeditor 使用配置教程
2012-08-16 11:24 1082<script type="text/java ... -
like语句中文有问题 mysql like语句 like的用法 解决方法
2012-08-14 11:17 3559在做MySQL的Like查询是发现中文搜索总是有问题 方法 ... -
php正则表达式常用正则电子邮件手机qq列子
2012-08-03 17:43 1222class Verify{ 003 /** 004 * ... -
mysql_fetch_assoc用法
2012-08-03 11:04 1442$query="SELECT `id` FROM ` ... -
smarty二维数组读取
2012-08-02 10:38 875{foreach item=foo from=$video k ... -
模拟nokie手机访问百度
2012-07-28 11:29 628$tra=new tra(); $my_header2=arr ... -
C:WINDOWS empphp18B.tmp
2012-07-27 10:07 854图片上传 出现 C:WINDOWS empphp18B. ... -
Latin1是什么编码是ISO-8859-1的别名
2012-07-21 11:26 1505atin1 Latin1是ISO-8859-1的别名,有些 ... -
smarty定界符与js冲突的问题
2012-07-20 16:27 1764smarty定界符与js冲突的问题 2010-01-29 11 ... -
php对象错误Call to a member function on a non-object
2012-07-19 17:13 1817php对象错误Call to a member functio ... -
php邮件发送已经测试ok
2012-07-18 10:54 773<?php class smtp { /* Pub ... -
php防盗链 htaccess
2012-07-18 23:09 681下面开始讲解:比如你的图片都在img目录下,那就在该目录下放一 ... -
php global 与 GLOBAL
2012-07-18 23:28 1106php global 与 GLOBAL 标签: 杂谈 须申 ... -
json.parse与json.stringify的作用区别
2012-07-17 20:19 1817标签: json.parse json.stringify ... -
破解无线网络密码
2012-07-20 23:08 935如何破解无线网络密码 ...
相关推荐
$_SERVER[‘REMOTE_HOST’] //当前用户主机名 $_SERVER[‘REQUEST_URI’] //URL$_SERVER[‘REMOTE_PORT’] //端口。 $_SERVER[‘SERVER_NAME’] //服务器主机的名称。 $_SERVER[‘PHP_SELF’]//正在执行脚本的...
$_SERVER[PHP_SELF], $_SERVER[SCRIPT_NAME], $_SERVER[‘REQUEST_URI’] 在用法上是非常相似的,他们返回的都是与当前正在使用的页面地址有关的信息,这里列出一些相关的例子,帮助确定哪些是在你的脚本最适合的。...
复制代码 代码如下:function getsiteurl() { global $_SCONFIG;...$_SERVER[‘PHP_SELF’]:$_SERVER[‘SCRIPT_NAME’]); return shtmlspecialchars(‘http://’.$_SERVER[‘HTTP_HOST’].substr($uri, 0, strrpos($uri,
empty($_SERVER[“REQUEST_URI”])){ $scriptName = $_SERVER[“REQUEST_URI”]; $nowurl = $scriptName; }else{ $scriptName = $_SERVER[“PHP_SELF”]; if(empty($_SERVER[“QUERY_STRING”])) $nowurl = $script...
empty($_SERVER[”REQUEST_URI”])) { $scriptName = $_SERVER[”REQUEST_URI”]; $nowurl = $scriptName; } else { $scriptName = $_SERVER[”PHP_SELF”]; if(empty($_SERVER[”QUERY_STRING”])) $nowurl = $...
PHP获取当前url路径的函数及服务器变量:QUERY_STRING、REQUEST_URI、SCRIPT_NAME、PHP_SELF
empty($_SERVER[“REQUEST_URI”])) { $scriptName = $_SERVER[“REQUEST_URI”]; $nowurl = $scriptName; } else { $scriptName = $_SERVER[“PHP_SELF”]; if(empty($_SERVER[“QUERY_STRING”])) { $nowurl = $...
$_SERVER['SCRIPT_NAME'] : $_SERVER['PHP_SELF']); //当前脚本 比如forum $_G['basescript'] = CURSCRIPT; //站点地址 $_G['siteurl'] = htmlspecialchars(‘http://’.$_SERVER['HTTP_HOST'].preg_replace(“/\/+...
//获得当前的脚本网址 function GetCurUrl(){ if(!empty($_SERVER[“REQUEST_... $scriptName = $_SERVER[“PHP_SELF”]; if(empty($_SERVER[“QUERY_STRING”])) $nowurl = $scriptName; else $now
* $_SERVER["REQUEST_URI"] 访问此页面所需的URI * $_SERVER["SCRIPT_NAME"] 包含当前脚本的路径 * $_SERVER["PHP_SELF"] 当前正在执行脚本的文件名 * 适用于列表多条件筛选处理,如:价格,时间,类型等等 * @...
empty($_server[“REQUEST_URI”])){ $scriptName = $_SERVER[“REQUEST_URI”]; $nowurl = $scriptName; }else{ $scriptName = $_SERVER[“PHP_SELF”]; if(empty($_SERVER[“QUERY_S
$_SERVER['PHP_SELF']; $client->setRedirectUri($redirect_uri); ``` 1. In the script handling the redirect URI, exchange the authorization code for an access token: ```php if (isset($_GET['code']...
14.5.3. Retrieving Validated Fields and other Reports 14.5.3.1. Querying if the input is valid 14.5.3.2. Getting Invalid, Missing, or Unknown Fields 14.5.3.3. Getting Valid Fields 14.5.4. Using ...