$ _ GET and $ _ POST functions in php. Isn't the value submitted to the php file? Why can't I see the php Suffix in the address bar?

Source: Internet
Author: User
Php reply content: the $ _ GET and $ _ POST functions obtain the pass value from the GET or POST request in the php program. The GET request can see the pass value in the address bar, the post request will pass the value in the entity-body (message body), but it cannot be seen in the address bar (it can be obtained through packet capture, so do not think the POST value is safer than the GET value)

I wrote a small program to demonstrate the similarities and differences between GET and POST values. Enter the content in the input box of the first line. Click "test get" to send a GET request to the server and pass the value. The server also returns the confirmation message. Similarly, enter the content in the input box of the second line, click "test post" to send a POST request and pass the value. The returned confirmation information is also displayed.

The page displayed in the browser is as follows:
HTML code: HTML code:

[The server confirms that the GET request value is received]
In the address bar, you can clearly see value = rabbit, and there is a message at the bottom to confirm that the value is received.

Let's take a look at the HTTP packet content of the GET request. The value "rabbit" to be passed is in the request URL and passed as the parameter value (that is, what you see in the address bar ).

[The server confirms the transfer value of the POST request]
What is different from the preceding GET value transfer is that the POST request value is not reflected in the address bar (so many people intuitively think that POST value transfer is safer than GET ).
Let's look at the message content of the POST request. By directly reading the packet content, you can see that the request URL does not contain any value-passing content, that is why you cannot see it in the address bar, and in the message body below, you can see Value: rabbit clearly. Let's look at the message content of the POST request. By directly reading the packet content, you can see that the request URL does not contain any value-passing content, that is why you cannot see it in the address bar, and in the message body below, you can see Value: rabbit clearly.

Although the two methods for passing values differ greatly, the methods for reading and passing values in php programs are similar, that is, they are directly read through the $ _ GET and $ _ POST functions.
[Appendix] test program code:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.