Example _php instance for the for loop and switch statement usages in the thinkphp template

Source: Internet
Author: User
Tags php template codeigniter smarty template zend framework
This article describes the use of the For loop and switch statements in the thinkphp template. Share to everyone for your reference, as follows:

1.for usage

 
  

Case

 
  
   
  {$i}
 
  

resolves to

for ($i =1; $i <100; $i +=1) {  echo $i;}

2.switch usage

 
  
  
   
    
   Output content 1
  
   
  
   
    
   output 2
  
   
  default condition 
   
 
  

Case

 
    
  
   
    
   value1
  
     
  
   
    
   value2
  
     
  default
   
 
  

You can also use variables for the Value property of the case, for example:

 
    
  
   
    
   admin
  
     
  
   
    
   member
  
     
  default
   
 
  

Comprehensive case

 
    
  
       
   
        
   
        
   
        
   
        
   
    Default  
  
   
 
  

More interested in thinkphp related content readers can view this site topic: "thinkphp Introductory Tutorial", "thinkphp Template Operation Skills Summary", "thinkphp Common Methods Summary", "CodeIgniter Getting Started Tutorial", "CI ( CodeIgniter) Framework Advanced Tutorial, Zend Framework Introduction tutorial, Smarty Template Primer Basic Tutorial and PHP template technology summary.

It is hoped that this article is helpful to the PHP program design based on thinkphp framework.

  • 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.