您的位置:澳门402永利com > 编程应用 > 【转载】详解 $_SERVER 函数中QUERY_STRING和REQUEST_U

【转载】详解 $_SERVER 函数中QUERY_STRING和REQUEST_U

发布时间:2019-09-23 20:45编辑:编程应用浏览(133)

    实例:

    实例:

    1,)
    结果:
    $_SERVER['QUERY_STRING'] = "";
    $_SERVER['REQUEST_URI']= "/aaa/";
    $_SERVER['SCRIPT_NAME']= "/aaa/index.php";
    $_SERVER['PHP_SELF']= "/aaa/index.php";

    1,)

    2,
    结果:
    $_SERVER['QUERY_STRING'] = "p=222";
    $_SERVER['REQUEST_URI']= "/aaa/?p=222";
    $_SERVER['SCRIPT_NAME']= "/aaa/index.php";
    $_SERVER['PHP_SELF']= "/aaa/index.php";

    结果:

    3,
    结果:
    $_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["QUERY_STRING"]赢得查询 语句,实例中可见,获取的是?前边的值
    $_SERVER["REQUEST_URI"]获取 后边的值,包含/
    $_SERVER["SCRIPT_NAME"]收获当前剧本的路径,如:index.php
    $_SERVER["PHP_SELF"]现阶段正值奉行脚本的文本名

    $_SERVER['REQUEST_URI']= "/aaa/";

    $_SERVER['SCRIPT_NAME']= "/aaa/index.php";

    $_SERVER['PHP_SELF']= "/aaa/index.php";

    2,(附带查询)

    结果:

    $_SERVER['QUERY_STRING'] = "p=222";

    $_SERVER['REQUEST_URI']= "/aaa/?p=222";

    $_SERVER['SCRIPT_NAME']= "/aaa/index.php";

    $_SERVER['PHP_SELF']= "/aaa/index.php";

    3,

    结果:

    $_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"]获取 后边的值,包涵/

    $_SERVER["SCRIPT_NAME"]获得当前剧本的门道,如:index.php

    $_SERVER["PHP_SELF"]当下正值执行脚本的文件名

    本文由澳门402永利com发布于编程应用,转载请注明出处:【转载】详解 $_SERVER 函数中QUERY_STRING和REQUEST_U

    关键词:

上一篇:没有了

下一篇:没有了