{if $like[ex1].id==$currentvalue}checked{/if}
//currentid就是你的那个checkbox的值

解决方案 »

  1.   

    既然用smarty,干脆用它的html_checkboxes好了,可以指定selected的http://smarty.php.net/manual/en/language.function.html.checkboxes.php
      

  2.   

    html_checkboxes感觉他的这个用着不是很舒服.呵呵!
      

  3.   

    问题是:{if $like[ex1].id==$currentvalue}checked{/if}
    我返回给smarty是个数组啊,并不是单独的变量,因为我也不知道他有多少个值。
    也就是$currentvalue 他是个数组
      

  4.   

    嘿,不用html_checkboxs的话,也可以用{php}包含php code的,
    但是很奇怪为什么不用呢