php thinkphp 使用系统环境变量

1. 问题,打印$_ENV为空,thinkphp env()函数和ENV::get()都获取不到系统的环境变量   

在docker运行环境的时候,指定了环境变量,  可以使用getenv()函数获取, 也可以在php.ini中修改配置   variables_order = "EGPCS"

 

This directive determines which super global arrays are registered when PHPstarts up. G,P,C,E & S are abbreviations for the following respective superglobals: GET, POST, COOKIE, ENV and SERVER. There is a performance penaltypaid for the registration of these arrays and because ENV is not as commonly used as the others, ENV is not recommended on productions servers. You can still get access to the environment variables through getenv() should you need to.

 
posted @ 2023-06-02 11:52  jackduan1  阅读(194)  评论(0编辑  收藏  举报