How to Get the Current URL Inside @if Statement (Blade) in Laravel 4?

前端 未结 28 2615
眼角桃花
眼角桃花 2020-11-28 01:15

I am using Laravel 4. I would like to access the current URL inside an @if condition in a view using the Laravel\'s Blade templating engine but I don\'t know ho

28条回答
  •  清歌不尽
    2020-11-28 01:16

    You will get the url by using the below code.

    For Example your URL like https//www.example.com/testurl?test

    echo url()->current();
    Result : https//www.example.com/testurl
    
    echo url()->full();
    Result: https//www.example.com/testurl?test
    

提交回复
热议问题