100: How does PHP obtain the parameter Hi of the PUT and DELETE requests? hello, everyone. I am trying to use PHP to implement the RESTful & nbsp; API interface. now I have encountered a problem: when the REQUEST type is POST or GET, PHP can easily obtain the parameters input by the client through $ _ POST, $ _ GET, and $ _ REQUEST; however, if the request type is PUT or DELETE 100, how does PHP obtain the parameters of the PUT and DELETE requests?
Hi everyone, I'm trying to use PHP to implement the RESTful API. now I have encountered a problem:
When the REQUEST type is POST or GET, PHP can easily obtain the parameters input by the client through $ _ POST, $ _ GET, and $ _ REQUEST; however, when the request type is PUT or DELETE, I don't know which method PHP should use to obtain parameters.
Have you ever encountered a similar problem? Please kindly advise me ~ PHP RESTful shared:
------ Solution --------------------
The most stupid method: $ METHOD = $ _ SERVER ['request _ method']
Then Judge
------ Solution --------------------
At the end of this post, xuzuning edited some. php at 11:52:45 on
$ Type = $ _ SERVER ['request _ method'];
Parse_str (file_get_contents ('php: // input'), $ data );
$ Data = array_merge ($ _ GET, $ _ POST, $ data );
// Perform operations based on the value of $ type