How exactly is PHP creating superglobal $_POST, $_GET, $_COOKIE and $_REQUEST?

后端 未结 4 1901
遥遥无期
遥遥无期 2021-02-02 11:38

I\'m sorry for confusing title of the question, I\'ll try to clarify what the issue is.

I\'m doing some work with Mongrel2 server and I\'m writing a PHP handler that has

4条回答
  •  不要未来只要你来
    2021-02-02 11:55

    Found on php.net maybe this will be useful:

    $_POST = array();
    $str = 'first=value&arr[]=foo+bar&arr[]=baz';
    parse_str(html_entity_decode($str), $_POST);
    print_r($_POST);
    
    Array
    (
        [first] => value
        [arr] => Array
            (
                [0] => foo bar
                [1] => baz
            )
    
    )
    

    Note:

    The magic_quotes_gpc setting affects the output of this function, as parse_str() uses the same mechanism that PHP uses to populate the $_GET, $_POST, etc. variables.

    http://php.net/manual/en/function.parse-str.php

提交回复
热议问题