Detailed explanation of variables_order parameter

藏色散人
Release: 2023-04-07 09:50:02
forward
2208 people have browsed it

Detailed explanation of variables_order parameter

● $_ENV in PHP is an array containing server-side environment variables. It is a super global variable in PHP and we can directly access it anywhere in the PHP program.

● $_ENV just passively accepts server-side environment variables and converts them into array elements. You can try to output it directly.

● When you want to see what is in a variable, there are three ways I know:

1, var_dump($_ENV);

2、print_r($_ENV);

3、foreach($_ENV as $key=>$val){echo $key. '--------'.$val.'<br>';}

● Among these three methods, the first one I think is the most convenient and output content format clear.

● Since the $_ENV variable depends on the environment variable of the server, the results printed by the $_ENV variable obtained from different servers may be completely different. So it is not possible to list a complete list like $_SERVER. The following are the more common elements contained in the $_ENV array:

● Sometimes, $_ENV will be empty. The reason is usually that the configuration item of the php configuration file php.ini is: variables_order = "GPCS". To make the value of $_ENV not empty, the value of variables_order should be added with a capital letter "E", that is: variables_order = "EGPCS".

● The above configuration represents the source and order of external variables accepted by PHP. EGPCS is the abbreviation of Environment, Get, Post, Cookies, and Server. If E is missing from the configuration of variables_order, PHP cannot accept environment variables, and $_ENV will be empty.

● Since turning on $_ENV, that is, variables_order = "EGPCS" will cause some performance losses, according to PHP officials, it is not recommended in production environments. They prefer to use the getenv (string $varname) function to obtain the value in Environment, and this needs to be noted when programming. If $_ENV is used during programming and variables_order is not configured as variables_order = "EGPCS", an error may be reported when the program is run.

Recommended: [PHP Tutorial]

The above is the detailed content of Detailed explanation of variables_order parameter. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:juejin.im
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template