我想得到这个网址的最后一句话:
http://localhost:8888/articles/tags/Europa
Run Code Online (Sandbox Code Playgroud)
我怎么能在Laravel做这个?有了这个{{URL::current()}}我得到完整的URL.我试过,{{URL::current().split('/').last}}但后来我得到错误:Function split() is deprecated
您还可以使用Request类的segment方法.
$var = Request::segment(3);
Run Code Online (Sandbox Code Playgroud)
这将根据API文档捕获URI的第3段:http: //laravel.com/api/5.1/Illuminate/Http/Request.html#method_segment