用户
 找回密码
 入住 CI 中国社区
搜索
查看: 4730|回复: 1
收起左侧

[讨论/交流] 关后缀后设置$config['url_suffix'] = ".html";

[复制链接]
发表于 2010-2-16 17:21:50 | 显示全部楼层 |阅读模式
我设置$config['url_suffix'] = ".html";
访问:welcome.html
但显示的是404页
看了他的去后缀带码,并加也入了日志,发现,路由中"."都转换为“_”,所以不会去掉".html"
PHP复制代码
 
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";
好了,你们有这种情况吗,还是我哪没有设置好!给提点建议,我是小白,谢谢了!
发表于 2010-2-16 22:21:42 | 显示全部楼层
正常加后缀,rewrite加后缀都没问题

本版积分规则