The use _php base of Get variable in PHP

Source: Internet
Author: User
Tags explode
Http_get_vars is saved with a Get variable since PHP4.1.0, and the get variables are mainly derived from the following methods

For example, a URL that uses the method of a form to obtain information about the server for instance, a get way. So all the request variables will pass

The URL is passed to the server, and the server handles the variables that get out based on the configuration call associated interpreter.



This article discusses how to pass the value of a URL to get

We all know URL values are URLs? Variable name = variable Value

This way to submit requests for example

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

This approach is what we're now doing.

If you have more variables, you can use the ' & ' symbol to connect variables

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

The above method for the browser directly to the variable to the corresponding array, we do not need to go too much understanding. Here's what I'm going to talk about.


For example:

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


This example shows that we use the symbol ', ' as a variable delimiter, where we can do this in two ways,
I. Modification of php.ini

——
; List of separator (s) used by the PHP to parse input URL into variables.
; The Default is "&".
; Note:every character in the directive is considered as separator!
Arg_separator.input = ";,"
————

Second, write their own interpretation of grammar

List ($key, $value) =$_get; Break out a Get variable
$tmp =explode (",", $value); Separate data

The advantage of this usage is that others cannot know who is using the value you are passing, and you 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

This kind of get method of the transfer value, in fact, the same method and method two, need to convert the key into value to decompose, I think this method is better than the previous method

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

You should have already got the data.


The above methods for me to browse other sites to see the phenomenon of the method, I do not know whether the correct. For PHP default installation users like to use the default Get Pass value method

If the company has specific requirements can consider the use of the following method ~

There are limits to learning, please correct me if there is something wrong.


                                      Sports98 Write by 2002-8-16

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.