Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有标准类型的uri:
www.example.com/controler/function/id
如何从 url 中删除 id 部分(它始终是一个数字)?
如果你的 ID 真的很糟糕,你可以使用 History API 来隐藏它:
if(history.replaceState) { history.replaceState(null, '', 'http://www.example.com/controller/function'); }
它不适用于较旧的浏览器,但如果它仅用于美学目的(并且这些最好是重要的;否则,不要这样做!)那么它应该没问题。