Ajax is an asynchronous callback method!
It also works with transmission methods on the server side, such as GET or POST.
What I am talking about here is that when xml or json data is transmitted,
PHP differs from other server languages in that it encapsulates the requested data into server variables (which may be incorrect)
In this way, the user can easily obtain the GET or POST value.
However, when sending xml or json directly, it should be a data stream sent to the server!
However, PHP does not receive data streams on the surface. This problem has been plagued for a long time.
(Other languages, such as asp/jsp, can receive data streams through the request component)
After searching online and viewing some examples, I finally found a solution !!
It turns out that php can get the transmitted data stream !!
$ Input = file_get_contents ('php: // input ');
The above code can get a data stream from post. As for the content, it depends on the sent data, which may be text or binary.
The file_get_contents function can be used later than php4.3.0 !!
This problem has been solved for a long time !!.
I found that using php: // input can obtain a data stream. Can I send an output stream! The answer is yes!
Use the file_put_contents Function
File_get_contents ('php: // output', $ input );
In this way, the submitted information will be output to the webpage !! Similar to echo and print !!
But file_get_contents can only be used after php5 !!
There are more and more ajax frameworks, and the transfer formats used in each framework are different !! The framework only makes it easier for me to use and improve development efficiency!
It encapsulates an underlying principle !! If you want to learn more deeply and thoroughly, you should open the surface and understand the essential things, so that you can continue to stay unchanged!
I haven't posted any posts for a long time !! I have been replacing water. The above is my recent work experience !!