Home >Backend Development >PHP Tutorial >Why is php $_ENV empty?

Why is php $_ENV empty?

怪我咯
怪我咯Original
2017-07-11 16:54:011759browse

$_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. Many of them are determined by the system PHP is running on. A complete list is not possible. You need to check PHP Check the server's system documentation to determine its specific environment variables. Like $_SERVER, this is also an automatic global variable and is valid in all scripts. There is no need to use the global keyword to access it in functions or object methods. In the following example, use the foreach statement to output all the environment-related information of the server where PHP is located that can be used in PHP for users to view.

$_ENV records some system environment variables (because it involves the actual operating system, it is impossible to give a complete list of $_ENV).

But some friends' $_ENV is empty. The possible reasons are:
The variable_order value of your php.ini is "GPCS", which means that the system is in The order when defining PHPpredefined variables is GET, POST, COOKIES, SERVER. Environment(E) is not defined. You can modify the variables_order value of the php.ini file as you want. The desired sequence, such as: "EGPCS". At this time, the value of $_ENV can be obtained

EGPCS value (EGPCS is the abbreviation of Environment, Get, Post, Cookies, Server - this is the full range of external variable sources in PHP)

The above is the detailed content of Why is php $_ENV empty?. For more information, please follow other related articles on the PHP Chinese website!

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