代码点火器 2.1 - 删除部分 URI


Codeigniter 2.1 - remove part of the uri

我有标准类型的uri:

www.example.com/controler/function/id

如何从 url 中删除 id 部分(它始终是一个数字)?

如果你的ID真的这么糟糕,你可以使用历史API来隐藏它:

if(history.replaceState) {
    history.replaceState(null, '', 'http://www.example.com/controller/function');
}

不适用于较旧的浏览器,但如果它只是出于美学目的(那些最好很重要;否则,不要这样做!),那么它应该没问题。