0
我想在使用html_options生成html選項時使用string_format格式化輸出。在Smarty中輸出過濾器html_options
例如,我試圖讓選擇具有前導零:
<select>
{$options=range(1,12)}
{html_options values=$options output=$options|string_format:'%02d'}
{/select}
這給01如預期的第一選擇,但其餘的空白標籤。這應該基於this page(在該頁面上搜索'truncate')上的示例進行工作,所以我不確定我在做什麼錯誤。