【发布时间】:2018-01-04 12:44:40
【问题描述】:
我有一个设置为 true 的值,当我在刀片中回显时,它显示为 1,我怎样才能让它回显为 true?
$test = true
{{ $test }} //1
最好设置为:
$test = 'true'
或者还有其他方法吗?
【问题讨论】:
-
echo $test ? 'true' : 'false';或者类似的东西?
我有一个设置为 true 的值,当我在刀片中回显时,它显示为 1,我怎样才能让它回显为 true?
$test = true
{{ $test }} //1
最好设置为:
$test = 'true'
或者还有其他方法吗?
【问题讨论】:
echo $test ? 'true' : 'false'; 或者类似的东西?
如果您需要将true 或false 作为字符串回显,请执行以下操作:
{{ $test ? 'true' : 'false' }}
【讨论】: