在不解析的情况下获取Laravel中的当前URL? [英] Get current URL in Laravel without parsing?

查看:39
本文介绍了在不解析的情况下获取Laravel中的当前URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

获取当前URL很容易:

It's quite easy to get the current URL:

Request::url()

这将返回类似的内容:

http://localhost/some/or/other/path

但是,如果我想要一种简单的方法来获取:

However, if I want an easy way to get only:

some/or/other/path

我该怎么办?没有parse_url,有没有办法做到这一点? IE. Laravel有内置的内置方法吗?

What would I do? Is there a way to do this without parse_url? I.e. Does Laravel have an inherent built-in way to do this?

推荐答案

Request::path() ?

$uri = Request::path();

这篇关于在不解析的情况下获取Laravel中的当前URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆