非法的偏移量类型-Laravel 5.3-ConnectionFactory.php-每个模型 [英] Illegal offset type - Laravel 5.3 - ConnectionFactory.php - Every Model
问题描述
首先为英语不好,而不是母语而感到抱歉.
First sorry for bad english, not native.
我有一个在XAMPP,Windows 7计算机上运行的Laravel 5.3应用程序.
I'v an Laravel 5.3 App running on XAMPP, windows 7 machine.
一切工作都很好,而且我没有对代码进行任何影响更改,只是发生了.
Everything was working great, and i don't have made any impact changes on code, it just happened.
每次我的应用尝试尝试与mysql建立连接时,都会显示此错误:
Everytime my app trys to build the connection with mysql this error is shown:
FatalThrowableError in ConnectionFactory.php line 237:
Illegal offset type
in ConnectionFactory.php line 237
ConnectionFactory->createConnector(array('driver' => 'mysql', 'host' => '127.0.0.1', 'port' => '3306', 'database' => 'megaboff', 'username' => 'root', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => true, 'engine' => null, 'name' => 'mysql')) in ConnectionFactory.php line 126
at ConnectionFactory->Illuminate\Database\Connectors\{closure}()
at call_user_func(object(Closure)) in Connection.php line 965
at Connection->getPdo() in Connection.php line 986
at Connection->getReadPdo() in Connection.php line 423
at Connection->getPdoForSelect(true) in Connection.php line 333
我可以使用修补程序访问我的应用程序和数据库中的数据.它仅在浏览器中不起作用.
通过浏览器对数据库的任何查询都会发生此相同的错误.我没有更改数据库配置或环境文件.这是数组:
Any query to the database via browser this same error occurs. I did not change database config or env file. Here is the array:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'megaboff'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
我可能会根据您的需要为您提供更多信息,因为现在我不知道为什么会这样.
I would likely provide you more info as you seem it's needed, because now i don't have a clue why this is happening.
预先感谢, 佩德罗
推荐答案
尝试使用命令"php artisan config:cache"或"php artisan config:clear". 也可以尝试在.env文件中设置数据库配置.
Try the command "php artisan config:cache" or "php artisan config:clear". Can try too set your database configuration in the file .env.
这篇关于非法的偏移量类型-Laravel 5.3-ConnectionFactory.php-每个模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!