Php get variable usage _ PHP Tutorial

Source: Internet
Author: User
Use the GET variable in PHP. After PHP4.1.0, HTTP_GET_VARS is saved using the GET variable. The GET variable mainly comes from the following method to request the server for obtaining information, for example, URL, use FORM's ME after PHP4.1.0 to save HTTP_GET_VARS with The GET variable. The GET variable mainly comes from the following methods:

For example, the URL that requests the server to obtain information, use the form method as the get method. In this way, all request variables will pass

The URL is passed to the server, and the server calls the relevant interpreter according to the configuration to process these GET variables.



This article discusses how to pass values in url get mode.

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

For example

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

This method is common to us.

If there are more variables, use the '&' symbol to connect to the variable.

Example: http://www.bbs.bbc.com? Page = 1 & title = Welcome % 20Sports98

The above method is to convert the variables directly to the corresponding array in the browser, so we don't need to know much about it. The topics I want to discuss are as follows:


For example:

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


In this example, we use the ',' symbol as the variable Separator. here we can use two methods to implement 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 the explanation Syntax by yourself

List ($ key, $ value) = $ _ GET; // splits the GET variable out.
$ Tmp = explode (",", $ value); // separates data

The advantage of this usage is that others cannot know who is using the value you passed, and you need to understand the usage of each value.

++


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

The pass-through method of this type of GET method is actually the same as method 2. what is needed is to convert the KEY into VALUE for decomposition. I think this method is better than the previous method.

It is more convenient.
$ Value = key ($ _ GET );
$ Tmp = explode (",", $ value );

You should have obtained the data.


The above method is the method that I think of when I browse other sites. I wonder if it is correct. Users who install PHP by default prefer to use the default GET value passing method.

If the company has specific requirements, consider using the following methods ~

Learning is limited. please correct me if you have any questions.


Sports98 Write by 2002-8-16

For example, URL, using FORM's ME...

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.