php - 在 laravel 5.1 中获取 fullUrl

标签 php laravel laravel-5 laravel-routing

我有多个 Bootstrap 选项卡,其中每个选项卡都执行与其他选项卡不同的操作,例如

app-url/users#creat-admin-users-tab app-url/users#creat-regular-users-tab

在 Laravel 中有什么方法可以获取完整的 url,包括#tab-name

感谢您的宝贵时间。

最佳答案

Laravel 具有返回当前 url 的功能。全部在此页面中指定:http://laravel.com/api/5.0/Illuminate/Http/Request.html

您要查找的是 Request::fullUrl()

假设我在 http://laravel.dev/test?test=1 ,下面是方法和结果:

Request::fullUrl()
// Returns: http://laravel.dev/test?test=1
Request::url()
// Returns: http://laravel.dev/test
Request::path()
// Returns: test
Request::root()
// Returns: http://laravel.dev 

关于php - 在 laravel 5.1 中获取 fullUrl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33687496/

相关文章:

laravel-5 - 如何将中间件从 laravel 5 中的包附加到现有的命名路由?

jquery - laravel 5.5 不加载 jquery/vuejs

php - 如何让 PHPUnit 打印内部异常?

php - 可空的自引用与复合键使用 Doctrine

拉拉维尔。在具有关系的模型中使用scope()

laravel - Eloquent 模型到表格的映射?

php - MySQL/PHP : Auto-Suggest entries similar to this one

php - 结合两个下拉选项来检索一个结果 ajax/php

Laravel - Mailcatcher 显示 'This site can’ 无法到达'页面

php - Laravel 将 `id` 更改为 `AUTO_INCREMENT`