当使用curl时,Lumen使用laravel中的.env文件(Lumen uses .env file from laravel when using curl)

系统教程 行业动态 更新时间:2024-06-14 16:57:17
当使用curl时,Lumen使用laravel中的.env文件(Lumen uses .env file from laravel when using curl)

我有一个laravel应用程序和一个带流明的应用程序,它们都有不同的数据库。

当我通过邮递员向流明打电话时,它正在找不到自己的数据库。

但是当我使用ixudra/curl lumen从laravel进行卷曲调用时,尝试使用laravel项目中laravel/.env文件中编写的数据库名称,而不是lumen/.env 。 是因为配置都是用php全局缓存的,所以流明认为它已经加载了它并且正在使用laravel中的那个?

流明没有config文件夹我不能硬编码那里的值。

有任何想法吗??

I have an application with laravel and one with lumen, both have different databases.

When I make a post call via postman to lumen, it is unsing his own database.

But when I do a curl call from laravel with ixudra/curl lumen tries to use the database name that is written in the laravel/.env file from the laravel project and not the lumen/.env. Is it because both the config is cached globally with php so lumen think it has already loaded it and is using the one from laravel instead?

Lumen has no config folder I can't hardcode the value there.

Any ideas??

最满意答案

您可以在流明应用程序中创建配置文件夹,并从vendor/laravel/lumen-framework/config/database.php复制database.php文件,这样您就可以根据需要对数据库配置进行必要的更改。

You can create a config folder in your lumen app, and copy the database.php file from vendor/laravel/lumen-framework/config/database.php, this way you can make necessary changes to your database configuration, if required.

更多推荐

本文发布于:2023-04-12 19:55:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/8fbd134c80279e3b24db2237d7e3b684.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   Lumen   curl   laravel   file

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!