thinkphp Template Switch Label usage example _php tutorial

Source: Internet
Author: User
The switch label in the thinkphp template is used to output different values in the template according to different conditions.

The thinkphp template engine supports switch judgment and can output different results according to different conditions, using the following format:

 
  
  
   
    
   Output content 1
  
   
  
   
    
   output 2
  
   
  default condition 
   
 
  

Examples of usage are as follows:

 
  
  
   
    
   Administrator
  
   
  visitors 
   
 
  

Note here:

The Name property can use a function as well as a system variable whose property value is a variable name, without a $ symbol, and a $ symbol is required when using a variable with value, as shown in the example above.

While value values in the case of the use of variables, no longer support the simultaneous judgment of multiple conditions , such as the following multi-conditional judgment.

Multi-Conditional judgment:
The Value property of case can support multiple conditions while judging, using | Symbol to split:

 
  
  
   
    
   Image format File
  
   
  
    Other format file
 
  

This means that if the value of $_get["type"] is GIF, PNG, or JPG, it is judged as an image format.

The Name property can also be a system variable, and you can use functions such as:

 
  
   
  ......
 
  

http://www.bkjia.com/PHPjc/824725.html www.bkjia.com true http://www.bkjia.com/PHPjc/824725.html techarticle the switch label in the thinkphp template is used to output different values in the template according to different conditions. thinkphp template engine supports switch judgment, can output different results according to different conditions, using ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.