有没有办法在没有数据库连接的情况下使用 Laravel?我打算使用刀片和 VueJS 创建一个前端网站,该网站将使用第三方 API,而且我不需要数据库。
目前,我收到此错误,我不确定如何绕过它。
Database name seems incorrect
You're using the default database name laravel. This database does not exist.
Edit the .env file and use the correct database name in the DB_DATABASE key
Run Code Online (Sandbox Code Playgroud)
这个检查出现在 Laravel 5.6.29 中,通过 Ignition 服务的DefaultDbNameSolutionProvider
.
解决方案消息有点误导,因为它假设您想要使用数据库。它试图传达 (a) 您已配置为使用默认数据库\xe2\x80\xa0,并且 (b) 该默认数据库不存在,因此 (c) 您应该将数据库名称更改为您环境的实际价值。
\n\n由于您没有数据库,因此进行设置后DB_DATABASE=unused
您就不会再收到此错误了。当然,如果你打电话DB::connection()
,那就会爆炸。但这是预料之中的。
\xe2\x80\xa0 Laravel 默认识别的两个数据库名称是"laravel"
和"homestead"
。
归档时间: |
|
查看次数: |
14491 次 |
最近记录: |