且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Laravel 5.2中访问控制器中的URL段

更新时间:2023-09-14 09:09:46

在laravel 5.2中,您可以这样做..

In laravel 5.2 you can do it this way..

echo request()->segment(2);

request()是Laravel 5.2中提供的几个辅助函数之一.它返回当前的请求对象,因此您无需在类顶部的外观使用use语句.

request() is one of the several helper functions provided in Laravel 5.2. It returns the current request object thus you don't need use statement for the facade on the top of your class.