sunaning 发表于 2010-2-16 17:21:50

关后缀后设置$config['url_suffix'] = ".html";

我设置$config['url_suffix'] = ".html";
访问:welcome.html
但显示的是404页
看了他的去后缀带码,并加也入了日志,发现,路由中"."都转换为“_”,所以不会去掉".html"

function _remove_url_suffix()
      {

                if($this->config->item('url_suffix') != "")
                {
                        log_message('debug', "url_suffix:".$this->uri_string);
                        $this->uri_string = preg_replace("|".preg_quote($this->config->item('url_suffix'))."$|", "", $this->uri_string);
                        log_message('debug',"url_suffix:".$this->uri_string);
                }
      }

我改为了:
function _remove_url_suffix()
      {

                if($this->config->item('url_suffix') != "")
                {
                        $this->uri_string = preg_replace("|_".preg_quote($this->config->item('url_suffix'))."$|", "", $this->uri_string);

                }
      }
config.php改成:$config['url_suffix'] = "html";
好了,你们有这种情况吗,还是我哪没有设置好!给提点建议,我是小白,谢谢了!

visvoy 发表于 2010-2-16 22:21:42

正常加后缀,rewrite加后缀都没问题
页: [1]
查看完整版本: 关后缀后设置$config['url_suffix'] = ".html";