当前位置:网站首页>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.路由分组

边栏推荐
- PHP realizes the automatic reverse search prompt of the search box
- 元宇宙是一个炒作的科幻概念,还是互联网发展的下半场?
- hackmyvm: kitty walkthrough
- How to log in to Alibaba Cloud server using the admin account
- mysql 原生语句点滴学习记录
- VIKINGS: 1 vulnhub walkthrough
- After Alibaba Cloud sets up domain name resolution redirection, I cannot use Chrome to access it
- hackmyvm-hopper预排
- Orasi: 1 vulnhub walkthrough
- 如何一步一步的:玩转全民拼购!
猜你喜欢

How to calculate the distance between two points on the earth (with formula derivation)

CTF introductory notes ping

文件上传漏洞

The CTF introductory notes of SQL injection

【泰山众筹】模式为什么一直都这么火热?是有原因的

hackmyvm: again walkthrough

ES6 array extension methods map, filter, reduce, fill and array traversal for…in for…of arr.forEach

Alfa: 1 vulnhub walkthrough

hackmyvm: controller walkthrough

库存现金、现金管理制度、现金的账务处理、银行存款、银行存款的账务处理、银行存款的核对
随机推荐
(3) string
超级云APP,陪伴您一起成长的软件
hackmyvm-random walkthrough
A network security guinea pig's learning path - scripting of advanced usage of nmap
hackmyvm-bunny预排
管理会计(对内)指引、管理会计要素及其具体内容(可能考,考前记一下,推荐记一下四个大点即可)、
不懂“赚钱逻辑”,你永远都是社会最底层(广告电商)
Introduction to PHP (self-study notes)
Scrapy crawler encounters redirection 301/302 problem solution
SATA M2 SSD 无法安装系统的解决方法
一次代码审计的笔记(CVE-2018-12613 phpmyadmin文件包含漏洞)
(1) the print () function, escape character, binary and character encoding, variables, data type, the input () function, operator
(5) Modules and packages, encoding formats, file operations, directory operations
Sensitive information leakage
战场:3(双子叶植物)vulnhub走读
CTF入门之md5
Laravel随笔记录
CTF入门笔记之SQL注入
MOMENTUM: 2 vulnhub walkthrough
动力:2 vulnhub预排