Thinkphp模板标签if和eq的区别和比较实例分析,thinkphpeq_PHP教程

WBOY
Release: 2016-07-13 09:48:08
Original
1013 people have browsed it

Thinkphp模板标签if和eq的区别和比较实例分析,thinkphpeq

本文实例讲述了Thinkphp模板标签if和eq的区别和比较。分享给大家供大家参考。具体分析如下:

在TP模板语言中。if和eq都可以用于变量的比较。总结以下几点:

1.两个变量的比较:

<if condition="$item.group_id eq $one.group_id">
<eq name="item.group_id" value="$one.group_id">

Copy after login

前者的IF是判断失败的,用后者的(或)则OK。需要注意:name那里是不用加$变量符号的,而value那里要加$变量符号。

2.还有值为空(NULL)的时候:

<if condition="name neq 'NULL'">just a test</if>
<neq name="name" velue="">just a test</neq>

Copy after login

前者的IF是判断失败的,用后者的(或)则可以识别null为""

3.多维数组且下标为0的时候:

<if condition="name.0 neq 'test'">just a test</if>
<eq name="name.0″ velue="test">just a test</eq>

Copy after login

前者用IF是根本不能通过编译的,用后面的eq就可以

希望本文所述对大家基于ThinkPHP的php程序设计有所帮助。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1024905.htmlTechArticleThinkphp模板标签if和eq的区别和比较实例分析,thinkphpeq 本文实例讲述了Thinkphp模板标签if和eq的区别和比较。分享给大家供大家参考。具体分...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!