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

前端 未结 6 720
滥情空心
滥情空心 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:01

    Here is code you can get url segment.

    {{ Request::segment(1) }}
    

    If you don't want the data to be escaped then use {!! !!} else use {{ }}.

    {!! Request::segment(1) !!}
    

    https://laravel.com/docs/4.2/requests

提交回复
热议问题