The Post method is used to add data according to the rest specification. If you submit the object in the form of a traditional application/x-www-form-urlencoded form, you need to take out the value of each field, put it in the parameter, and then restore it to the corresponding object for processing after it is received by the server. This is additional work for both the client and the server.
The best way to transfer objects between the client and the server is to use JSON or XML, and the client and the server have the tools to serialize or deserialize the object. Individuals are more inclined to JSON, the code is more concise, the conversion is more convenient.
When the client submits the request, it sets Content-type to "Application/json;charset=utf-8″, tells the server that the message body is JSON, and the server determines $_server[' Content_Type '], if it is JSON, The message body is obtained using file_get_contents (' Php://input '), which is the JSON string after the object is serialized and then processed accordingly.
©2016, frozen fish. Please respect the author's labor results, copy reprint reservation site link! Application Development notes