Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the differences between put and post in php

2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly talks about "what are the differences between put and post in php". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "what are the differences between put and post in php?"

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 the upload effect are different; 3. The URI of the POST request represents the resources of the closed entity, and the URI in the PUT request represents the closed entity in the request.

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

The difference between put and post in php

1. The difference between using support and scope:

PHP provides support for PUT methods. In the method of interaction with the server defined by Http, PUT sends messages from the message ontology to a URL, which is similar to POST in form

PHP provides support for HTTP PUT methods used by clients such as Netscape Composer and W3C Amaya

In PHP 4, you must use a standard input stream to read the contents of a HTTP PUT

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 difference in the upload process:

When uploading a file by POST, it is usually necessary to combine all the information into multipart, and then the server decodes the information. The decoding process consumes memory and CPU resources, especially when uploading large files.

The PUT method allows you to pass the contents of the file without other information through the socket link established with the server, which is more direct in effect.

3. The difference of upload effect:

When PHP receives a request from the PUT method, it will save the uploaded file to 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 somewhere else

4. The fundamental difference between POST and PUT requests

The URI requested by POST represents a resource that processes the closed entity, which may be a data receiving process, a gateway to a protocol, or an independent entity that receives comments

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

The server cannot apply the request to other resources

If the server wants the request to be applied to another URI, it must send a 301response

The user agent can decide whether or not to forward the request at its own judgment

At this point, I believe you have a deeper understanding of "what is the difference between put and post in php". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report