Home >Backend Development >PHP Tutorial >ThinkPHP template judgment output Present tag usage detailed explanation_PHP tutorial

ThinkPHP template judgment output Present tag usage detailed explanation_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:26:181129browse

The present tag of ThinkPHP template is used to determine whether the template variable has been assigned a value .

The present tag of ThinkPHP template engine is used to determine whether the template variable has been assigned a value. Its function is equivalent to the isset() function behavior in PHP , and the format is as follows:

<present name="变量名">要输出的内容</present>

Usage examples are as follows:

<present name="username">{$username} 你好!</present>

This example is equivalent to:

if(isset($username)){
  echo "$username 你好!";
}

In addition, the notpresent tag can be used to judge that there is no assignment. The usage is as follows:

<notpresent name="username">username不存在活未登录</notpresent>

You can also combine the above two tags into:

<present name="username">{$username} 你好!<else/>username不存在活未登录</present>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/824721.htmlTechArticleThe present tag of ThinkPHP template is used to determine whether the template variable has been assigned a value. The present tag of ThinkPHP template engine is used to determine whether the template variable has been assigned a value. Its function is equivalent to PH...
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