Heim  >  Artikel  >  php教程  >  Thinkphp模板标签if和eq的区别和比较实例分析

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

WBOY
WBOYOriginal
2016-06-06 20:02:411237Durchsuche

这篇文章主要介绍了Thinkphp模板标签if和eq的区别和比较,实例分析了Thinkphp模板标签if和eq用于变量比较的区别,需要的朋友可以参考下

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

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

1.两个变量的比较:

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

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

just a test just a test

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

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

just a test just a test

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

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

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn