如何获取视图地址
在控制器之外questions/ask?title=Laravel%20how%20how%20to%20get%20the%20current%20URL%20without%20a%20domain%20name
在控制器之外questions/ask?title=Laravel%20how%20how%20to%20get%20the%20current%20URL%20without%20a%20domain%20name
你可以通过以下方式获取当前URL(不包括域名):
request()->path()
\Request::path()
来获取路径。 - sinazapath()
不会返回查询参数。 - SergkeiM
request()->query()->all()
来自此答案。 - ourmandaverequest()->query('title')
。https://laravel.com/docs/5.7/requests#retrieving-input - ourmandave