Home>Article>Backend Development> ThinkPHP template range judgment output In tag and Range tag usage
This article mainly introduces the usage of the In tag and the Range tag of the ThinkPHP template range judgment output. Friends who need it can refer to the
The in tag and range tag of the ThinkPHP template are used tojudge a certain template. Whether the variable is within a certain range.
1.in tag
ThinkPHP’s in tag is used to determine whether a template variable is within a certain range. The format is as follows:
要输出的内容
When used, in the module Set variables in operations (such as Index/display) and assign values to the template:
$groupId = 1; $this->assign( "groupId", $groupId );
Template/Tpl/default/Index/display.html, use the in tag as follows:
管理群组
Run the Example, can output:
Management Group
The php code of this example is equivalent to:
Note: The value of the variable can also be a string or array , the value of the value attribute can use variables.
2.notin tag
There is also a notin tag corresponding to the in tag, which means it is judged not to be within a certain range:
Usage such as:
非管理群组
The above two tag examples combined are equivalent to:
管理群组 非管理群组
3.range tag
ThinkPHP’s in and notin tags can also be used range tag instead, such as:
管理群组
The above example is equivalent to the in tag. When the value of the type attribute is notin, it is equivalent to the notin tag.
Related recommendations:
How to use thinkPHP’s Html template tag
ThinkPHP template judgment output Empty tag usage
The above is the detailed content of ThinkPHP template range judgment output In tag and Range tag usage. For more information, please follow other related articles on the PHP Chinese website!