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

后端 未结 4 1850
遥遥无期
遥遥无期 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:59

    I am trying to contribute to this question with the knowledge I know.

    Sending a HTTP Request with such headers can duplicate POST variable

    POST /somepage.php HTTP/1.1
    Host: www.domain.com
    User-Agent: Mozilla/12.0
    Content-Length: 31
    Content-Type: application/x-www-form-urlencoded
    
    parameter=value&testcode=value1
    

    Also you might want to check the HttpRequest libray of PHP. [Start here]. For POST data you can override the previous POST content using HttpRequest::setPostFields() and set your own data for it.

    HttpRequest::setPostFields(array(
        "parameter" => "value"
    ));
    

提交回复
热议问题