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 does $_ GET refer to in php

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces the relevant knowledge of "what is $_ GET in php". The editor shows you the operation process through an actual case. The method of operation is simple and fast, and it is practical. I hope this article "what $_ GET in php refers to" can help you solve the problem.

In php, "$_ GET" means to get GET data, which is a predefined variable that is mainly used to receive form data submitted by the GET method in form forms. The data structure of the "$_ GET" variable is an associative array, the key name of the array is the value of the form element name, and the value of the array is the value of the corresponding form.

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

In php, "$_ GET" means to get GET data, which is a predefined variable that is mainly used to receive form data submitted in form forms using the GET method. The GET method is the default method for the method property in an form form. The form data submitted using the GET method is attached to the URL and sent to the server as part of the URL.

During the development of the program, because the data submitted by the GET method is attached to the URL and sent, the information of the type "parameters passed by the URL+ user" will be displayed in the address bar of URL, as follows:

Http://url?name1=value1&name2=value2...

Where url is the form response address (such as http://c.biancheng.net), name1 and name2 are the names of the form elements, and value1 and value2 are the values of the form elements. Use "?" between url and form elements. Separated, while multiple form elements are separated by a "&". Each form element is formatted as "name=value" and is fixed.

Because different browsers have different restrictions on the length of URL, we must pay attention to the amount of data when submitting data using the GET method. If the length of the data exceeds the limit of the browser, the data will be truncated, resulting in data loss. The restrictions on URL length imposed by mainstream browsers are shown in the following table:

The $_ GET global variable is similar to the structure of $_ POST in that its data structure is an associative array, the key name of the array is the value of the form element name, and the value of the array is the value of the corresponding form. $_ GET can not only get the data from the form form, but any parameter in URL can be obtained using $_ GET.

Another point to note is that when using $_ POST or $_ GET to get form data in PHP, it is case-sensitive, so you should be careful not to ignore the case of letters during development.

[example] the form tag content in the user.html file below is the simplest form.

Form submission user name:

Secret code:

Birthday:

Let's add the form of the user.html file and look at the address bar of URL

The predefined variable $_ GET can be used directly in the user.php file to get the data. The $_ GET global variable is an associative array whose key name is the value of the form element name, and the value of the array is the value of the corresponding form. (note only if the parameters in URL can be obtained using $_ GET. )

So much for the introduction of "what does $_ GET in php refer to"? thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

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