我想在我的 foreach 循环中使用项目的 id 获得一个条件变量。我想尝试的(只是演示代码)如下,但它只是给我一个错误。
php
$this->smarty->assign(array(
'demo' => array(
'foo_bar' => 'succeed!',
'foo_seat' => 'succeed also!'
),
'bar' => 'bar',
'seat' => 'seat'
));
tpl
value="{$demo.foo_{$bar}}"
错误
Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "application/views/overzicht/selectie.tpl" on line 55 "{$demo.foo{$bar}}" - Unexpected "{", expected one of: "}"
谁有想法?