I have done searches and cannot find anything that solves this in Laravel 5.2.
Is it possible to generate relative URLs in Laravel 5.2?
Meaning, instead of http://example.com/mypage
I get simply /mypage
?
If you are trying to generate them, rather than retrieve the current one, you can pass a 3rd parameter to the route
function.
echo route('about', [], false);
If you pass true
(the default) as the 3rd parameter it will give you
If you pass false
as the 3rd parameter it will give you
/about
是的,您应该使用$request->path()
,它将返回URI
。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.