网络中间件 laravel 5.2

web middleware laravel 5.2

我正在尝试使用中间件网络,但是当我将路由放入其中时,我的项目停止工作并显示此错误

Whoops, looks like something went wrong.

当我在中间件网络之外删除并使用我的路由时,再次工作。可能是什么? (对不起我的英语,它不是我的母语)。

这个有效:

Route::get('/contact', 'TicketsController@create');
Route::post('/contact', 'TicketsController@store');

Route::group(['middleware' => ['web']], function () {

});

这行不通:

Route::group(['middleware' => ['web']], function () {
    Route::get('/contact', 'TicketsController@create');
    Route::post('/contact', 'TicketsController@store');
});

我找到了解决方法

  1. 您必须使用 php artisan key:generate
  2. 生成密钥
  3. config/app.php中放置生成密钥'=>'xxxxxxxxxxxxxxxxxx',

我在 config/app.php 中设置了真正的调试 属性 ('debug' => env('APP_DEBUG', true) ) 我看看如何修复