ThinkPHP模板判断输出Empty标签用法详解
作者:shichen2014 时间:2023-11-14 20:46:54
ThinkPHP模板的empty标签用于判断模板变量是否为空值。
ThinkPHP模板empty标签用来判断模板变量是否为空值,其功能相当于PHP中的empty()函数行为。empty标签使用格式如下:
<empty name="变量名">要输出的内容</empty>
具体用法如下例所示:
<empty name="username">username 为空值</empty
该例子等同于:
<?php
if(empty($username)){
echo 'username 为空值';
}
?>
如果判断非空值可使用notempty标签,如下所示:
<notempty name="username">username 不为空</notempty>
两个标签合并起来可写成:
<empty name="username">username 为空值<else/>username 不为空</empty>
标签:ThinkPHP,模板,标签
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Python爬虫爬取一个网页上的图片地址实例代码
2021-07-25 09:58:25
![](https://img.aspxhome.com/file/2023/5/125185_0s.png)
Python用K-means聚类算法进行客户分群的实现
2022-04-03 23:35:18
![](https://img.aspxhome.com/file/2023/5/92345_0s.jpg)
Python实现字符串匹配的KMP算法
2021-02-10 05:03:45
修改Python的pyxmpp2中的主循环使其提高性能
2022-07-22 15:26:53
启发式评估(heuristic evaluation)
2009-08-27 13:03:00
![](https://img.aspxhome.com/file/UploadPic/20098/27/e7a78b11-32s.jpg)
JQuery中对Select的option项的添加、删除、取值
2024-04-22 12:59:14
Selenium多窗口切换解决方案
2021-07-06 14:56:33
![](https://img.aspxhome.com/file/2023/3/95683_0s.png)
Fibonacci数,Θ(log n)
2010-03-28 13:28:00
python实现井字棋游戏
2022-02-27 15:16:49
MySQL借助DB实现分布式锁思路详解
2024-01-16 03:17:13
![](https://img.aspxhome.com/file/2023/9/78099_0s.png)
angularJS实现表格部分列展开缩起示例代码
2024-04-16 10:40:42
![](https://img.aspxhome.com/file/2023/3/136563_0s.png)
最基础的Python的socket编程入门教程
2022-10-13 03:38:46
Python IO文件管理的具体使用
2023-04-06 01:54:47
![](https://img.aspxhome.com/file/2023/5/134755_0s.png)
MySQL Community Server 8.0.29安装配置方法图文教程
2024-01-22 12:02:55
![](https://img.aspxhome.com/file/2023/6/128366_0s.jpg)
python列表与列表算法详解
2022-09-20 20:36:51
![](https://img.aspxhome.com/file/2023/7/128557_0s.png)
Python编程如何在递归函数中使用迭代器
2023-08-04 11:20:24
![](https://img.aspxhome.com/file/2023/6/80446_0s.jpg)
jquery在vue脚手架中的使用方式示例
2023-07-02 17:07:49
Python正则表达re模块之findall()函数详解
2021-04-20 05:00:16
在PyCharm的 Terminal(终端)切换Python版本的方法
2021-10-31 08:37:07
![](https://img.aspxhome.com/file/2023/2/112002_0s.png)
Python ndarray 数组的变形详情
2023-05-13 14:58:47
![](https://img.aspxhome.com/file/2023/9/86239_0s.png)