在laravel中显示数据库凭据

时间:2016-09-18 13:41:44

标签: php mysql laravel

我是laravel(v5.3)的新手

我偶然得到了这个问题,(我仍处于开发模式)

我运行了我的应用程序并且其工作正常,但是当数据库关闭时,我收到此错误

in Connector.php line 119
at PDO->__construct('mysql:host=127.0.0.1;port=3306;dbname=social', 'root', '', array('0', '2', '0', false, false)) in Connector.php line 119
at Connector->createPdoConnection('mysql:host=127.0.0.1;port=3306;dbname=social', 'root', '', array('0', '2', '0', false, false)) in Connector.php line 56
at Connector->createConnection('mysql:host=127.0.0.1;port=3306;dbname=social', array('driver' => 'mysql', 'host' => '127.0.0.1', 'port' => '3306', 'database' => 'social', 'username' => 'root', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => true, 'engine' => null, 'name' => 'mysql'), array('0', '2', '0', false, false)) in MySqlConnector.php line 24
at MySqlConnector->connect(array('driver' => 'mysql', 'host' => '127.0.0.1', 'port' => '3306', 'database' => 'social', 'username' => 'root', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => true, 'engine' => null, 'name' => 'mysql')) in ConnectionFactory.php line 100

当我看到数据库凭据时,我很惊讶。

此错误是否与生产模式中的错误相同?

有没有办法停止显示数据库连接信息?

1 个答案:

答案 0 :(得分:2)

将作品APP_DEBUG中的.env设置为false