Yii pseudo static

How to access static php files under the yii framework without having to create multiple actions, here is a simple record, I hope to leading to a better implementation:
1, configured in main.php

'urlManager'=>array(  
            'urlFormat'=>'path',  
            'showScriptName'=>false,  
            'rules'=>array(  
                  
'post/<view:.*>.html'=>'post/page/',  
  
  
                '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',  
            ),  
        ), 

‘post/.html’=>’post/page/’ This line of code is the most important

2, implement a postController

<?php  
class PostController extends Controller{  
    public function actions() {  
        return array (  
                'page' => array (  
                        'class' => 'CViewAction'   
                )   
        );  
    }  
}  

3, add the post/pages directory in the corresponding views directory, and then add a static php file (such as 12345.php) in the pages directory
It can be accessed via http://domainname/post/12345.html. If there is a subdirectory (such as 20120920/123456.php), you can pass

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 51 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.