Home >Backend Development >PHP Tutorial >Laravel5 开启关闭 CSRF token 方法

Laravel5 开启关闭 CSRF token 方法

WBOY
WBOYOriginal
2016-06-20 12:39:421141browse

所有页面开启和关闭CSRF 参考:http://www.cnblogs.com/HD/p/4555369.html

部分页面不需要使用CSRF

/*** 指定页面不开启CSRF* @var string*/    private $openRoutes = ['test/url'];    /*** Handle an incoming request.* @param \Illuminate\Http\Request  $request* @param \Closure  $next* @return mixed*/public function handle($request, Closure $next){    if (in_array($request->path(), $this->openRoutes)) {       return $next($request);   }   return parent::handle($request, $next);}


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn