如何在laravel刀片`@ if`中使用变量?

时间:2020-07-11 13:52:23

标签: laravel laravel-blade

是否可以将$path变量传递给Blade表达式:

@if(Request::url() === 'http://project2.test/{{$path}}')

@if (Request::path() == '/{{$path}}')

1 个答案:

答案 0 :(得分:0)

您必须使用简单的PHP串联

@if(Request::url() === 'http://project2.test/'.$path )

@if (Request::path() == '/' . $path )