在 .blade.php 模板中评论

Comment in .blade.php template

我是 blade 模板的新手。我怎么在这里评论?

PHP我可以这样评论

<?php // echo $games;?>

Laravel Blade

{{ $game }}

在 blade 语法中,注释以 {{-- 开始并以 --}}

结束
{{-- this is a comment --}}

但是要注释掉多行,请使用标准的 PHP 块注释 ,例如:

<?php /* 
@if ($condition)
    {{ HTML::form("foo") }};
@endif
*/ ?> 

永远不要在 Blade 注释中嵌套 Blade and/or PHP 代码

See also whosebug.com/Why Blade comment causes page to crash?

在 laravel 8 中,您应该使用此语法进行评论

 {{--  --}} or <!-- -->