This article mainly introduces the Switch label usage of the ThinkPHP template. For more information, see the switch label in the ThinkPHP template to output different values in the template based on different situations.
The ThinkPHP template engine supports switch judgment and outputs different results based on different conditions. The format is as follows:
Output content 1
Output content 2
Default
Examples:
Administrator
Visitors
Note:
The name attribute can use functions and system variables. The attribute value is the variable name without the $ symbol, and the value must contain the $ symbol when using the variable, as shown in the preceding example.
The value of value does not support simultaneous judgment of multiple conditions when the variable method is used, as shown in the following multi-condition judgment.
Multi-condition judgment:
The value Attribute of case can support simultaneous judgment of multiple conditions. Use the | symbol for segmentation:
Image Format File
Other format files
This indicates that if $ _ GET ["type"] is set to gif, png, or jpg, the image format is used.
The name attribute can also be a system variable and a function can be used.Such:
......