简体   繁体   English

Web中间件laravel 5.2

[英]web middleware laravel 5.2

I'm trying to use the middleware web, but when I put my route inside it, my project stop working and shows this error 我正在尝试使用中间件网络,但是当我将路由放入其中时,我的项目停止工作并显示此错误

Whoops, looks like something went wrong. 哎呀,看起来像出事了。

When I remove and use my route outside the middleware web, works again. 当我删除并使用中间件网络之外的路由时,它将再次起作用。 What could be? 可能是什么? (Sorry for my english, it is not my native language). (对不起,我的英语,这不是我的母语)。

This works: 这有效:

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

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

});

This not works: 这不起作用:

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

I found how to solve this 我找到了解决方法

  1. you must generate a key with php artisan key:generate 您必须使用php artisan key:generate生成一个密钥
  2. In config/app.php place generate key' => 'xxxxxxxxxxxxxxxxxx', config / app.php位置生成密钥'=>'xxxxxxxxxxxxxxxxxx',

I set true debug property in config/app.php ('debug' => env('APP_DEBUG', true) ) and i see how to fix that 我在config / app.php中设置了真正的调试属性('debug'=> env('APP_DEBUG',true)),我知道如何解决这个问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM