Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Laravel 5.5的中间件中获取URL?_Laravel - Fatal编程技术网

如何在Laravel 5.5的中间件中获取URL?

如何在Laravel 5.5的中间件中获取URL?,laravel,Laravel,我有一个关于拉威尔5.5的项目 我在使用中间件 这就是代码 <?php namespace App\Http\Middleware; use Closure; class roleMiddleware { public function handle($request, Closure $next) { // if code to check where the url is // code here //else //code here //e

我有一个关于拉威尔5.5的项目 我在使用中间件 这就是代码

<?php
namespace App\Http\Middleware;
use Closure;
class roleMiddleware
{
 public function handle($request, Closure $next)
{
    // if code to check where the url is 
    // code here
    //else
    //code here
    //else
    //code
    //return $next($request);
}
}

您可以在中间件内部使用:

$request->url(); // without query string
对于查询字符串,您可以使用:

$request->fullUrl();

有关更多请求方法,请参阅illumb\Http\Request.php类。

如何从中间件中获取请求的url