首先, 在配置文件(config.php)里设置 URL_HTML_SUFFIX 设置静态后缀
[php]
<?php  
      
    return array(  
      
    'URL_HTML_SUFFIX'=>'.html',  //随意, 可设置其它的。  
      
    ....  
      
    //其它配置信息  
      
    );  
      
    ?>  
[/php]
然后使用U方法
U方法的定义规则如下(方括号内参数根据实际应用决定):
U('[项目://][路由@][分组名-模块/]操作? 参数1=值1[&参数N=值N]')
或者用数组的方式传入参数
U('[项目://][路由@][分组名-模块/]操作',array('参数1'=>'值1' [,'参数N'=>'值N']))
如果不定义项目和模块的话 就表示当前项目和模块名称,下面是一些简单的例子:
U('Myapp://...
昨天弄了好久没弄起这个伪静态,今天在公司看了一下公司的这个配置信息,终于也配置好了这个环境。
windows下ThinkPHP伪静态配置
nginx环境配置ThinkPHP伪静态
[html]
server {
	listen 80;
	server_name localhost;
	root E:/DEMO;
	index index.php index.html index.htm;
	autoindex on;
	
	location / {	    
 		 if (!-e $request_filename) {
                        #rewrite  ^/(.*)$  /index.php/$1  last;
			rewrite  ^/Home/(.*)$  /Home/index.php/$1  last;
                        break;
                }
        }
	location ...