thinkphp在html页面中写if语句怎么写
我在FuheAction.class.php写了$userinfo=M("userinfo");$fuhesql=$userinfo->query("selectuser...
我在FuheAction.class.php写了
$userinfo = M("userinfo");
$fuhesql = $userinfo->query("select
userinfo.FileId as 档案编号,
userinfo.username as 姓名,
userinfo.gender as 性别,
branchoneinfo.BranchOneName as I级机,
branchtwoinfo.BranchTwoName as II级机,
branchthreeinfo.BrahcnThreeName as III级机,
zhicheng.zhichengName as 职称,
userinfo.fuhe as 复核状态
from
userinfo join branchoneinfo on (userinfo.branchone = branchoneinfo.BranchOneId)
join branchtwoinfo on (userinfo.branchtwo= branchtwoinfo.BranchTwoId)
join branchthreeinfo on (userinfo.branchthree= branchthreeinfo.BranchThreeId)
join zhicheng on (userinfo.job = zhicheng.zhichengId)");
$this->assign("user",$fuhesql);
$this->display("HR:fuhe");
fuhe.html:
<volist name="user" id="use">
<tr>
<td bgcolor="#d4f8d4">
{{$use.性别}}
</td>
</tr>
然后返回的性别是0和1我希望0现实的是女,1显示的是男。这要怎么做?是在html里面做判断还是在FuheAction.class.php里做判断?具体这个if语句怎么写,写在哪求大神指教 展开
$userinfo = M("userinfo");
$fuhesql = $userinfo->query("select
userinfo.FileId as 档案编号,
userinfo.username as 姓名,
userinfo.gender as 性别,
branchoneinfo.BranchOneName as I级机,
branchtwoinfo.BranchTwoName as II级机,
branchthreeinfo.BrahcnThreeName as III级机,
zhicheng.zhichengName as 职称,
userinfo.fuhe as 复核状态
from
userinfo join branchoneinfo on (userinfo.branchone = branchoneinfo.BranchOneId)
join branchtwoinfo on (userinfo.branchtwo= branchtwoinfo.BranchTwoId)
join branchthreeinfo on (userinfo.branchthree= branchthreeinfo.BranchThreeId)
join zhicheng on (userinfo.job = zhicheng.zhichengId)");
$this->assign("user",$fuhesql);
$this->display("HR:fuhe");
fuhe.html:
<volist name="user" id="use">
<tr>
<td bgcolor="#d4f8d4">
{{$use.性别}}
</td>
</tr>
然后返回的性别是0和1我希望0现实的是女,1显示的是男。这要怎么做?是在html里面做判断还是在FuheAction.class.php里做判断?具体这个if语句怎么写,写在哪求大神指教 展开
3个回答
展开全部
同上
把我的总结复制给你吧:
if判断:
<if condition="条件">滚伍
<else />
</if>
1.在控制器输入如下:
public function demo6(){
$this->assign("num1",10);
$this->display("demo6");
}
2.在模板中输入:
<裂友body>
<if condition="$num1 neq 10">
变量num1值不等于10
<else />
等于10
</if>
</body>
条件:
eq 等于
neq 不等于
gt 大于
lt 小于
elt 小于肆备槐等于
heq 恒等
把我的总结复制给你吧:
if判断:
<if condition="条件">滚伍
<else />
</if>
1.在控制器输入如下:
public function demo6(){
$this->assign("num1",10);
$this->display("demo6");
}
2.在模板中输入:
<裂友body>
<if condition="$num1 neq 10">
变量num1值不等于10
<else />
等于10
</if>
</body>
条件:
eq 等于
neq 不等于
gt 大于
lt 小于
elt 小于肆备槐等于
heq 恒等
展开全部
<if condition='乱汪变量 eq 1'>哗烂仔男<else \>女</if>
就是这么简单 不明白继续历森追问
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<td bgcolor="#d4f8d4"纯迹销>
<php>if($user['做游性别'])==1{ echo "男"州袜;}else{echo "女";} </php>
</td>
<php>if($user['做游性别'])==1{ echo "男"州袜;}else{echo "女";} </php>
</td>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询