ThinkPHP template IF label usage details. The IF tag of ThinkPHP can be used to define complex condition judgments, for example, ifcondition ($ nameeq1) OR ($ namegt100) value1elseifcondition $ nameeq2value2elsevalue3if note ThinkPHP IF Tag can
Used to define complex condition judgmentsFor example:
value1
value2
value3
Note: The condition attribute supports eq and other judgment expressions. comparison labels are the same as above, but they do not support the use of symbols such as ">" and "<", because template parsing is obfuscated, so the following usage is incorrect:
value1
value2
Must be changed:
value1
value2
In addition, wePhp code can be used in the condition attributeFor example:
ThinkPHP
other Framework
The condition attribute supports dot syntax and object syntax, for example, automatically determining whether the user variable is an array or an object:
ThinkPHP
other Framework
Or you know that the user variable is an object.
ThinkPHP
other Framework
Note:Because the condition attribute of the if tag basically uses the php syntax, it is more concise to use the judgment tag and Switch tag. in principle, if you can use the switch or comparison label, try not to use the if label. Because switch and comparison labels can use variable regulators and system variables. IF the IF tag still cannot meet the requirements under some special requirements, you can use native php code or PHP label to directly write the code..
Condition is used to define complex condition judgments, such as: if condition = "($ name eq 1) OR ($ name gt 100) "value1elseif condition =" $ name eq 2 "/value2else/value3/if note...