当前位置:网站首页>Laravel 登录,中间件和路由分组
Laravel 登录,中间件和路由分组
2022-08-02 03:26:00 【陌潇】
laravel 做前端内容,路由验证登录时候需要用到路由中间件,可以自己自定义中间件。
1. 创建中间件的类
php artisan make:middleware CheckLogin
2.完善创建的类
<?php
namespace App\Http\Middleware;
use Closure;
class CheckLogin
{
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */
public function handle($request, Closure $next)
{
if(!isset($_COOKIE['uid'])){
return redirect('/');
}
return $next($request);
}
}
3.注册创建的类

4.路由分组

边栏推荐
猜你喜欢

xxe of CTF
![[sebastian/diff] A historical change extension library for comparing two texts](/img/c7/ea79db7a5003523ece7cf4f39e4987.png)
[sebastian/diff] A historical change extension library for comparing two texts

Offensive and defensive world - novice MISC area 1-12

Shuriken: 1 vulnhub walkthrough

CTF之xxe

2021-09-04 最简单的Golang定时器应用以及最简单的协程入门儿

(1) introduction to Thinkphp6, installation view, template rendering, variable assignment

Orasi: 1 vulnhub walkthrough

web渗透必玩的靶场——DVWA靶场 1(centos8.2+phpstudy安装环境)

VIKINGS: 1 vulnhub walkthrough
随机推荐
(4) Function, Bug, Class and Object, Encapsulation, Inheritance, Polymorphism, Copy
一次代码审计的笔记(CVE-2018-12613 phpmyadmin文件包含漏洞)
DNS详解
The focus of the Dom implementation input triggers
Masashi: 1 vulnhub walkthrough
Solve the problem that the 5+APP real machine test cannot access the background (same local area network)
WeChat applet development video loading: [Rendering layer network layer error] Failed to load media
How to calculate the distance between two points on the earth (with formula derivation)
hackmyvm: may walkthrough
DarkHole: 2 vulnhub walkthrough
After Alibaba Cloud sets up domain name resolution redirection, I cannot use Chrome to access it
会计账簿、会计账簿概述、会计账簿的启用与登记要求、会计账簿的格式和登记方法
MOMENTUM: 2 vulnhub walkthrough
Alibaba Cloud MySQL 5.7 installation and some major problems (total)
hackmyvm-bunny walkthrough
[Hello World教程] 使用HBuilder和Uni-app 生成一个简单的微信小程序DEMO
(3) string
Cookie is used to collect the admin privileges CTF foundation problem
链动2+1模式开发系统
Phonebook