The $_env in PHP stores some of the system's environment variables, depending on the environment and values.
But sometimes the $_env is empty and may have the following reasons:
The Variables_order value in PHP.ini is "gpcs", meaning that the order in which the system defines PHP predefined variables is get,post,cookies,server, and no Environment (E) is defined.
You can modify the Variables_order value of the php.ini file for the order you want, such as "Egpcs". At this point, the value of the $_env can be achieved
Egpcs Value: (Egpcs is the abbreviation for environment, GET, Post, Cookies, server-This is the entire range of external variable sources in PHP).
You can use foreach to traverse $_env data, or you can print the variable directly with Print_r ($_ENV) to view his data.
$_ENV records some system environment variables (because the actual operating system is involved, it is impossible to give a complete list of $_env).
The possible reasons for the $_env are:
The Variables_order value of your php.ini is "gpcs", which means that the order in which the system defines PHP predefined variables is get,post,cookies,server, and no Environment (E) is defined. You can modify the Variables_order value of the php.ini file for the order you want, such as "Egpcs". At this point, the value of the $_env can be achieved
Egpcs value (Egpcs is the abbreviation for environment, GET, Post, Cookies, server-This is the entire range of external variable sources in PHP)