我对 Twig 有疑问。
我有一个对象,其中包含一个类型为字符串的属性。该字符串包含一些空格“”,(例如“Prueba Primera”),但在 Twig View 中,当我显示文本时,该 View 仅显示“Prueba”,字符串的其他部分不显示。 这是我在 php 中的对象:
$informe->setTitulo("Prueba Primera");
这是我在 Twig 中的代码:
<input type = "text" name = "titulo" id = "titulo" class = "texto" value = {{informe.titulo}} disabled/>
Twig 仅显示:“Prueba”
最佳答案
在 Twig 值周围添加 "
,如下所示:
value="{{informe.titulo}}"
关于php - Twig 不显示带有空格的字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47100810/