Php Laravel 500(内部服务器错误)有时
每刷新几次页面,就会出现错误500,这不允许我从Laravel API获取数据。这一答复: { “消息”:“服务器错误” }{ “消息”:“服务器错误” } web.phpPhp Laravel 500(内部服务器错误)有时,php,laravel,Php,Laravel,每刷新几次页面,就会出现错误500,这不允许我从Laravel API获取数据。这一答复: { “消息”:“服务器错误” }{ “消息”:“服务器错误” } web.php Route::get('/product/{product}/details', 'ShopController@getProductDetails'); 报头请求 headers: { "X-CSRF-TOKEN": document.querySelector('me
Route::get('/product/{product}/details', 'ShopController@getProductDetails');
报头请求
headers: {
"X-CSRF-TOKEN": document.querySelector('meta[name="csrf-token"]').getAttribute('content')
},
axios
您可以查看存储/日志中的日志,查看发生了什么情况我也遇到了这个问题。 在日志文件中,有时会出现
Access denied for user 'forge'@'localhost' (using password: NO)
要解决此问题,请在
config/database.php
处缓存配置或更改数据库和用户名的默认值。如果这是您收到的唯一错误消息,您需要使用xdebug或使用dd()进行一些调试。:/What's is the logs?我可以看到您的控制器吗?如果有500,请检查您的日志,如果您试图在本地或临时环境中进行调试,您将得到原因。在.env中,您可以将您的APP_debug设置为true,然后不再显示“Server error”,而是显示出到底出了什么问题。前面提到的日志也是查找错误的好方法(位于存储/logs
)
Access denied for user 'forge'@'localhost' (using password: NO)