What is the difference between put and post in php

青灯夜游
Release: 2023-03-13 09:58:01
Original
3902 people have browsed it

Differences: 1. The PUT method is not as widely used as the POST method, but the PUT method is the most efficient way to upload files to the server; 2. The upload process and upload effect are different; 3. The URI representation of the POST request is processed The resource of the closed entity. The URI in the PUT request indicates the closed entity in the request.

What is the difference between put and post in php

The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

put and The difference between post

#1. The difference between usage support and scope:

PHP provides support for the PUT method, which is defined in Http and In the server's interaction method, PUT sends the message in the message body to a URL, similar in form to POST;

PHP provides HTTP PUT for clients such as Netscape Composer and W3C Amaya. Method support;

In PHP 4, the standard input stream must be used to read the content of an HTTP PUT;

The PUT method is not as widely used as the POST method, but the PUT method sends data to the server The most efficient way to upload files:

2. The difference in the upload process:

When uploading files via POST, you usually need to combine all the information into multipart and send it. The server then decodes the information, and the decoding process inevitably consumes memory and CPU resources. This phenomenon is especially obvious when uploading large files; the

PUT method allows you to establish a The socket link transfers the content of the file without any other information, and the effect is more direct;

3. The difference in upload effect:

PHP accepts the PUT method When requesting, the uploaded file will be stored in the same temporary directory as other files processed by the POST method; when the request ends, the temporary file will be deleted.

The PHP script used to process PUT must copy the file to other places;

4. The fundamental difference between POST and PUT requests

POST The URI of the request represents the resource that handles the closed entity. The resource may be a data receiving process, a gateway of a certain protocol, or an independent entity that receives annotations;

The URI in the PUT request represents the closed entity in the request - The user agent knows the target of the URI;

The server cannot apply the request to another resource;

If the server wants the request to apply to another URI, it must send a 301 response;

The user agent can decide whether to forward the request through its own judgment;

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of What is the difference between put and post in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!