这是一个双重问题:正确的答案将转到如何在PHP中执行,解释是否有任何优势,如果可能的话也会计数。
This is a double question: The correct answer will go to "How you do it in PHP" explaining if there is any advantage goes also counts if possible.
我只是好奇,因为我真的不知道,我在网页上看到很多。
I'm just curious because I really don't know and I see it a lot in webpages.
编辑:我不知道技术名称,但例如这里的Stackoverflow: stackoverflow/posts/edit/522452 就是我的意思是文件夹(这个术语以前在问题的标题中使用过)。
I don't know the technical name, but for example here on Stackoverflow: "stackoverflow/posts/edit/522452" is what I mean as "folders" (a term previously used in the title of the question).
推荐答案如果您引用 / posts / edit / 522452 风格的网址,而不是 /posts.asp?action=edit&postid=522452 风格的网址(或不管它转换为后端),通常通过URL重写器来完成,比如 mod_rewrite的 。该URL的规则可能如下所示:
If you're referring to /posts/edit/522452-style URLs as opposed to /posts.asp?action=edit&postid=522452-style URLs (or whatever it translates to on the back end), this is typically done through a URL rewriter, such as mod_rewrite. A rule for that URL might look like this:
RewriteRule ^/posts/(\w+)/(\d+) /posts.asp?action=\1&postid=\2两个主要优点这种类型的网址是:
The two primary advantages to this kind of URL are that:
在PHP中,您可以通过 $ _ GET ['action'] 和 $ _ GET ['postid'] ,就好像浏览器要求重写的表单一样。
In PHP, you can then access these options via $_GET['action'] and $_GET['postid'], exactly as if the browser had asked for the rewritten form.
更多推荐
我如何在PHP中进行URL重写?
发布评论