laravel 9在.env文件变量中使用base_path()
有一个特殊的字符串模式可以在.env文件变量中使用base_path()?
类似:my_path =%basepath%/my/path
There is a special string pattern to use base_path() into .env file variable ?
Something like : MY_PATH=%basePath%/my/path
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在.env中使用任何外部环境变量。
例如,您可以在shell调用中设置base_path:
然后,您只需在.env中使用它们,例如,
我认为您还可以在Web服务器中分配环境变量。
You can use any external environment variables in the .env.
For example, you could set BASE_PATH in a shell call:
Then you simply use them in the .env e.g.
I think you can also assign environment variables in your web server.
在.env中,您可以使用上面定义的变量,如果您有许多路径定义,则至少有助于保持文件清洁:
In .env you can use variables that you defined above, which helps at least to keep the file clean if you have many path definitions: