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

ThinkPHP template judgment output Empty tag usage detailed explanation_PHP tutorial

WBOY
Release: 2016-07-13 10:26:20
Original
866 people have browsed it

The empty tag of ThinkPHP template is used to determine whether the template variable is empty.

ThinkPHP template empty tag is used to determine whether the template variable is empty. Its function is equivalent to the empty() function behavior in PHP. The empty tag uses the following format:

<empty name="变量名">要输出的内容</empty>
Copy after login

The specific usage is as shown in the following example:

<empty name="username">username 为空值</empty
Copy after login

This example is equivalent to:

<&#63;php
if(empty($username)){
  echo 'username 为空值';
}
&#63;>
Copy after login

If you determine a non-empty value, you can use the notempty tag, as shown below:

<notempty name="username">username 不为空</notempty>
Copy after login

The two tags combined can be written as:

<empty name="username">username 为空值<else/>username 不为空</empty>
Copy after login

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/824718.htmlTechArticleThe empty tag of ThinkPHP template is used to determine whether the template variable is empty. ThinkPHP template empty tag is used to determine whether the template variable is empty. Its function is equivalent to the behavior of the empty() function in PHP...
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