• 欢迎浏览“String me = Creater\忠实的资深Linux玩家;”,请文明浏览,理性发言,有侵犯你的权益请邮件我(creater@vip.qq.com).
  • 把任何的失败都当作一次尝试,不要自卑;把所有的成功都想成是一种幸运,不要自傲。
  •    2年前 (2016-04-24)  ecshop |   抢沙发  18 
    文章评分 0 次,平均分 0.0

    实例:

    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"] 当前正在执行脚本的文件名

     

    除特别注明外,本站所有文章均为String me = "Creater\忠实的资深Linux玩家";原创,转载请注明出处来自http://unix8.net/home.php/4802.html

    关于

    发表评论

    暂无评论

    切换注册

    登录

    忘记密码 ?

    切换登录

    注册

    扫一扫二维码分享