Ec (2); php tutorial $ _ post function and $ _ get function details 1. get is to get data from the server, and post is to transfer data to the server; & nbsp; & nbsp; 2. get adds the data in the form to the url pointed to by action in the form of variablevalue, and uses & ldquo ;? & Rdquo; connection, and various variables are connected using & ldquo; & amp; & rdquo. Post script ec (2); script
Php tutorial $ _ post function and $ _ get Function
1. get is to get data from the server, and post is to send data to the server;
2. get adds the data in the form to the url pointed to by action in the form of variable = value, and the two use "?" And each variable is connected with an ampersands. Post is to place the data in the form's data body, according to the way the variables and values correspond, passed to the url pointed to by the action; fashion jewelry wholesale
Therefore, we can draw two other conclusions from the above:
1. The size of data transmitted by get is small and cannot exceed 2 kb. This is mainly because the url length is limited. The data size transmitted by post is large, so only post can be used for uploading files. It is generally not restricted by default. Theoretically, the maximum size of iis4 is 80 KB, and that of iis5 is kb;
2. get security is very low (because the user can see through the url), and post security is high (all its operations are invisible to the user ). However, the execution efficiency is better than the post method;
3. get restricts that the dataset value of form forms must be ascii characters, while post supports the entire iso000046 character set; cleaning cloth
4. get is the default form method;
5. data submitted in get mode is requested on the server side. querystring (), and request for data submitted in post mode. form () to obtain (this is not very clear );
Suggestion:
1. if it contains confidential information, it is recommended to use the post data submission method;
2. We recommend that you use the get method when querying data. We recommend that you use the post method when adding, modifying, or deleting data;
Get instance
The built-in $ _ get function is used to collect the value of sending a method = "get" from the form. Information is sent in the form of a get method. visible to the user (it will be displayed in the address bar of the browser), and the number of messages sent has been limited.
For example:
When a user clicks the "Submit" button, the url sent to the server may look like this:
Http: // localhost/demo/test. php? Username = lily & age = 28
In the "test. php" file, you can use the $ _ get function to collect form data (the name of the form field is automatically set to the key of the $ _ get array ):
Welcome
You are Years old!
When should we use method = "get?
When method = "get" is used in an html form, all variable names and values are displayed in the url. Note: This method should not be used in passwords or other sensitive information! However, because the variables are on the display URL, it is possible to bookmark the page. This can be useful in some cases. The get method is not suitable for variable values that are very large. It should not use a value greater than 2000 characters
$ _ Post instance
The built-in $ _ post function is used to collect the value in a form method = "post. Users cannot see the information sent in the form of post, and there is no limit on the amount of information sent. However, the post method has an 8 mb max size, which can be changed by default by setting post_max_size in the php. ini file ).
For example:
When a user clicks the "Submit" button, the url sent to the server may look like this:
Http: // localhost/demo/test. php
In the "test. php" file, you can now use the $ _ post function to collect form data (the name of the form field is automatically set to the key of the $ _ post array ):
Welcome !
You are Years old.
When should we use method = "post?
Users cannot see the information sent in the form of post, and there is no limit on the amount of information sent. However, because the variables are not displayed in the url, this is an impossible page for bookmarks.
Functions of php $ _ request
Php built-in functions include $ _ request in two forms: $ _ get, $ _ post, and $ _ cookie. $ _ Request function, which can be used to collect form data sent by get and post methods.
Welcome !
You are Years old.