How to access URL segment(s) in blade in Laravel 5?

前端 未结 6 734
滥情空心
滥情空心 2021-02-03 17:43

I have a url : http://localhost:8888/projects/oop/2

I want to access the first segment --> projects

I\'ve tried

6条回答
  •  广开言路
    2021-02-03 18:02

    Here is how one can do it via the global request helper function.

    {{ request()->segment(1) }}

    Note: request() returns the object of the Request class.

提交回复
热议问题