Lumen开发:简单实现auth用户认证
打开bootstrap/app.php,取消下面两段代码的注释,
$app->middleware([ App\Http\Middleware\ExampleMiddleware::class ]); $app->routeMiddleware([ 'auth' => App\Http\Middleware\Authenticate::class, ]);
打开router/web.php,加入以下路由代码,
$app->group(['middleware' => 'auth'], function ($app){ $app->get('hello', function() { echo 'hello, world'; }); });
访问 域名/hello,显示 hello, world。
https://laravel-china.org/docs/lumen/5.2/authentication/1863