Home > Article > Backend Development > The problem that PHP’s putenv function cannot be used in Chinese
If you know laravel, you can take a look at the above section; if you don’t, just go straight below the dividing line;
Any item in .env, here is MAIL_DRIVER as an example
Change it to "my" and use the env function, and you can get the value normally;
Change it to "I" and use the env function, and you can't get it normally;
<code>MAIL_DRIVER=我 var_dump(env(MAIL_DRIVER'')); // NULL MAIL_DRIVER=我的 var_dump(env(MAIL_DRIVER'')); // 我的</code>
This situation will also occur with other Chinese words such as "good";
I have to say; laravel is broad and profound; I have studied the source code of the env function;
The problem I finally identified is;
--------- ----------------------------------------Understand and understand the dividing line between laravel framework- --------------------------------------------------
<code>putenv("PROJECT_NAME=我的"); phpinfo();</code>
You can search for PROJECT_NAME in Environment in phpinfo
<code>putenv("PROJECT_NAME=我"); phpinfo();</code>
Project_NAME cannot be found in Environment in phpinfo
Dear friends, why is this? How to set Chinese value without any problem?