[英]Laravel 5.2 Middleware in elfinder
when the middleware is added to the elfinder I confronted with this error, but when I amount equal to the null set thhis problem fixed.当中间件添加到 elfinder 时,我遇到了这个错误,但是当我的数量等于空集时,这个问题就解决了。
'route' => [ 'prefix' => 'elfinder', 'middleware' => null, //Set to null to disable middleware filter ],
config/elfinder.php:配置/elfinder.php:
'route' => [ 'prefix' => 'elfinder', 'middleware' => ['web','auth'], //Set to null to disable middleware filter ],
my problem is:我的问题是:
this problem solve by under code to app/Http/Middleware/VerifyCsrfToken.php
这个问题通过代码到
app/Http/Middleware/VerifyCsrfToken.php
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
class VerifyCsrfToken extends BaseVerifier
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
'elfinder/ckeditor',
];
public function handle($request, Closure $next)
{
$regex = '#' . implode('|', $this->except) . '#';
if ($this->isReading($request) || $this->tokensMatch($request) || preg_match($regex, $request->path()))
{
return $this->addCookieToResponse($request, $next($request));
}
throw new TokenMismatchException;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.