The If label of the thinkphp can be
used to define complex condition judgments.For example:
value1
value2
value3
Note: in the condition attribute can support EQ and other judgment expressions, with the above comparison label, but does not support the use of ">", "<" and other symbols, because it will confuse the template parsing , so the following usage is wrong:
value1
value2
Must be changed to:
value1
value2
In addition, we can use PHP code in the condition attribute , for example:
thinkphp
other Framework
The Condition property can support point syntax and object syntax, such as automatically determining whether a user variable is an array or an object:
thinkphp
other Framework
Or know that the user variable is an object
thinkphp
other Framework
Note: Since the condition property of the IF tag is basically PHP syntax, it is much more concise to use the judgment tag and switch label as much as possible, in principle, the switch and the comparison label can be used to resolve as far as possible without the IF tag to complete. Because switch and comparison tags can use variable adjusters and system variables. If the IF tag still does not meet the requirements under certain special requirements, you can write the code directly using native PHP code or PHP tags .