laravel框架获取当前url 的方法 阿星小栈

 

1. 使用 Request 类:

$url = Request::getRequestUri();

2. 使用 $request 对象:

public function show(Request $request) 
{
    $url = $request->url();
}

3. 使用 URL 类:

$url = URL::current();  全部的url 

4. 使用 Input 类

$url = Input::url();

 

 

 

 

 

原文:https://www.cnblogs.com/wuoshiwzm/p/6243227.html 

posted @ 2018-11-13 10:25  阿星小栈  阅读(386)  评论(0编辑  收藏  举报