This post was updated 908 days ago and some of the ideas may be out of date.
开局提示!!!
在Windows中不要使用PhpStorm中的环境变量选项,它会使用export命令,导致报错“export : 无法将“export”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。”,因为export是Linux/Mac OS中的命令。


进入正题。。。
无效方法一: 使用set命令
set key value

可以看到在命令行里面设置生效了,但是PHP无法获取到。
有效方法二:使用$env变量
$env:key=value

经过测试使用$env变量就可以设置环境变量,并且PHP也能够获取到。
参与讨论