这篇文章主要介绍了ThinkPHP模板Switch标签用法,需要的朋友可以参考下
ThinkPHP模板中的switch标签用于在模板中根据不同情况输出不同的值。
ThinkPHP模板引擎支持switch判断,可根据不同条件输出不同的结果,使用格式如下:
用法举例如下:
此处注意:
name属性可以使用函数以及系统变量,,其属性值为变量名称,没有$符号,而value值使用变量时需要带$符号,如上面的例子所示。
而value的值在使用变量方式的情况下,不再支持多个条件的同时判断,如下面多条件判断。
多条件判断:
case 的 value 属性可以支持多个条件的同时判断,使用 | 符号进行分割:
此处表示如果$_GET["type"]的值是gif、png或者jpg的话,就判断为图像格式。
name属性还可以是系统变量,并且可以使用函数,如:

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version
God-level code editing software (SublimeText3)