我正在尝试使用XAMPP处理Laravel QueryException,让我更好地解释一下。在XAMPP中打开MySql服务时,一切正常,但是当我有意关闭它(或者说我忘了)并且尝试登录时,(显然)我收到此错误Exception:
Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] Connection refused.
(SQL: select * from `users` where `email` = test@yahoo.it limit 1)
例如,如何显示我的一个自定义错误页面而不是默认的Laravel QueryException?在哪里捕获异常?
即使我的应用程序不在生产模式下,我仍然想正确显示错误。
谢谢!
全部运行命令
php artisan cache:clear
php artisan route:clear
php artisan config:clear
php artisan view:clear
在.env
文件中,将DB_HOST
从127.0.0.1
更改为localhost