Home >Backend Development >PHP Tutorial >Use of GET variables in PHP_PHP tutorial

Use of GET variables in PHP_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 16:07:54879browse

Since PHP4.1.0, HTTP_GET_VARS will be saved using GET variables. GET variables mainly come from the following methods

To obtain data information from the server as a request method, for example, URL, use FORM's METHOD as the GET method. In this way, all request variables will be passed to the server through the

URL, and the server will call the relevant interpreter according to the configuration to process these GET variables.



This article discusses the value-passing of URL in GET method

We all know that the value-passing of URL is URL? Variable name = variable value

This method is used to submit the request. For example,

http://www.bbs.bbc.com?page=1

This method is what we are doing now Common

If there are too many variables, you can use the '&' symbol to connect the variables

For example: http://www.bbs.bbc.com?page=1&title=Welcome%20Sports98

The above method allows the browser to directly convert the variables into the corresponding array, and we do not need to know too much about it. The following are the topics I want to discuss


For example:

http://www.bbs.bbc.com?page=1,Welcome%20Sports98,Sports98,300


This example shows that we use the ',' symbol as the variable delimiter symbol. Here we can use two methods to achieve it.
1. Modify PHP.INI

— —
; List of separator(s) used by PHP to parse input URLs into variables.
; Default is "&".
; NOTE: Every character in this directive is considered as separator!
arg_separator.input = ";,"
————

2. Write your own interpretation syntax

list($key,$value)=$_GET; //Get variables Decompose it
$tmp=explode(",",$value); //Split the data

The advantage of this usage is that others cannot know who uses the value you pass, you yourself Need to understand the use of each value

+++++++++++++++++++++++++++++++++++++


Finally for
http://www.bbs.bbc.com/index.php?123,123433,234524,34563456,5463,78685,abc,Welcome%20Sports98

The value passed by this type of GET method is actually the same as method two. What is needed is to convert the KEY into VALUE for decomposition. I think this method is better than the previous method

and more convenient.
$value=key($_GET);
$tmp=explode(",",$value);

You should have obtained this data.


The above method is what I think of when I browse other sites. I don’t know if it is correct. For the default installation of PHP, users like to use the default GET value transfer method

If the company has specific requirements, you can consider using the latter method~

Please correct me.


                                 

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/315003.htmlTechArticleSince PHP4.1.0, HTTP_GET_VARS will be saved using GET variables. GET variables mainly come from the following methods to the server. To obtain data information, for example, URL, use FORM's ME...
Statement:
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