首页 > 解决方案 > 复数标签的语法

问题描述

鉴于 5.7 laravel 应用程序,我想考虑复数的项目数量,比如

{{ count($activeVoteCategories) }} vote @if(count($activeVoteCategories) > 1)s @endif

但结果标签无效,因为在最后一个“s”符号之前有不必要的空格:

6 vote s

如果我试图摆脱这个空间

  {{ count($activeVoteCategories) }} vote@if(count($activeVoteCategories) > 1)s @endif

我得到错误:

syntax error, unexpected 'endif' (T_ENDIF), expecting end of file (View: /mnt/_work_sdb8/wwwroot/lar/

我知道本地化功能有多种方法,但是这个网站没有本地化,它总是用英文......

哪个是正确的方法?

谢谢!

标签: laravel-5laravel-bladeplural

解决方案


推荐阅读