Home  >  Article  >  Backend Development  >  ThinkPHP中的数据显示在模板上的问题

ThinkPHP中的数据显示在模板上的问题

WBOY
WBOYOriginal
2016-06-23 13:41:53951browse

是这样的,从数据库中选出一堆记录,之后用foreach写到前台模板上面,数据库中性别字段使用0和1来表示,我想知道怎么把这个0和1在控制器中替换成男和女,然后再显示在前台?如果不能在控制器里面操作的话,在前台模板上面怎么写?
注意这里是从数据库中选出了很多条记录。


回复讨论(解决方案)

if判断不就可以了么?

if condition  smarty模板有这个  ,主要是控制checked,希望可以帮到你

前台页面用标签判断

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn