Laravel 如何在没有域名的情况下获取当前 URL?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/52589851/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 18:05:49  来源:igfitidea点击:

Laravel how to get the current URL without a domain name?

laravel

提问by symfony_fan

How to get the view address

如何获取查看地址

questions/ask?title=Laravel%20how%20to%20get%20the%20current%20URL%20without%20a%20domain%20name

question/ask?title=Laravel%20how%20to%20get%20the%20current%20URL%20without%20a%20domain%20name

Outside the controller

控制器外

回答by Sand Of Vega

You can get current URL without a domain name in anywhere by:

您可以通过以下方式在任何地方获取没有域名的当前 URL:

request()->path()

Source: Laravel HTTP Requests

来源:Laravel HTTP 请求