laravel数据库返回未定义索引错误

wa7juj8i  于 2021-06-21  发布在  Mysql
关注(0)|答案(1)|浏览(349)

我正在开发一个使用laravel5.6.18框架的项目。在我的database.php文件中,出现以下错误:
“未定义索引:驱动程序”
我的联系如下:

'connections' => [

    'sqlite' => [
        'driver' => 'sqlite',
        'database' => env('DB_DATABASE', database_path('database.sqlite')),
        'prefix' => '',
    ],
    'mysql' => [
        'driver' => 'mysql',
        'host' => env('DB_HOST', '127.0.0.1'),
        'port' => env('DB_PORT', '3306'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'charset' => 'utf8mb4',
        'collation' => 'utf8mb4_unicode_ci',
        'prefix' => '',
        'strict' => true,
        'engine' => null,
    ],

    'pgsql' => [
        'driver' => 'pgsql',
        'host' => env('DB_HOST', '127.0.0.1'),
        'port' => env('DB_PORT', '5432'),
        'database' => env('DB_DATABASE', 'forge'),
        'username' => env('DB_USERNAME', 'forge'),
        'password' => env('DB_PASSWORD', ''),
        'charset' => 'utf8',
        'prefix' => '',
        'schema' => 'public',
        'sslmode' => 'prefer',
    ],  
],
nzrxty8p

nzrxty8p1#

您需要在env文件中选择一个数据库驱动程序。您在env文件中设置了什么作为数据库驱动程序?在这里

DB_CONNECTION=driver

相关问题