实例:
1,http://localhost/aaa/ (打开aaa中的index.php)
结果:
$_SERVER['QUERY_STRING'] = "";
$_SERVER['REQUEST_URI'] = "/aaa/";
$_SERVER['SCRIPT_NAME'] = "/aaa/index.php";
$_SERVER['PHP_SELF'] = "/aaa/index.php";
2,http://localhost/aaa/?p=222 (附带查询)
结果:
$_SERVER['QUERY_STRING'] = "p=222";
$_SERVER['REQUEST_URI'] = "/aaa/?p=222";
$_SERVER['SCRIPT_NAME'] = "/aaa/index.php";
$_SERVER['PHP_SELF'] = "/aaa/index.php";
3,http://localhost/aaa/index.php?p=222&q=333
结果:
$_SERVER['QUERY_STRING'] = "p=222&q=333";
$_SERVER['REQUEST_URI'] = "/aaa/index.php?p=222&q=333";
$_SERVER['SCRIPT_NAME'] = "/aaa/index.php";
$_SERVER['PHP_SELF'] = "/aaa/index.php";
由实例可知:
$_SERVER["QUERY_STRING"] 获取查询 语句,实例中可知,获取的是?后面的值
$_SERVER["REQUEST_URI"] 获取 http://localhost 后面的值,包括/
$_SERVER["SCRIPT_NAME"] 获取当前脚本的路径,如:index.php
$_SERVER["PHP_SELF"] 当前正在执行脚本的文件名
相关文章
- 11-12C#中struct和class的区别详解 (转载)
- 11-12oracle中函数和存储过程的区别和联系【转载竹沥半夏】
- 11-12SQL 中详解round(),floor(),ceiling()函数的用法和区别?
- 11-12【转载】Oracle 中count(1) 、count(*) 和count(列名) 函数的区别
- 11-12sql server 中删除表中数据truncate和delete的区别(转载自.net学习网)
- 11-12【转载】3D/2D中的D3DXMatrixPerspectiveFovLH和D3DXMatrixOrthoLH投影函数详解
- 11-12【转载】详解 $_SERVER 函数中QUERY_STRING和REQUEST_URI区别
- 11-12SQLServer中DataLength()和Len()两内置函数的区别(转载)
- 11-12C#中struct和class的区别详解 (转载)
- 11-12详解 $_SERVER 函数中QUERY_STRING和REQUEST_URI区别