在URL中传递参数(不包含php GET) [英] Passing parameters in the URL (not with php GET)
问题描述
可能存在重复:
mod-rewrite和查询字符串
我知道的唯一方法在URL中传递参数是使用PHP中的GET方法。但是我看到很多网站直接使用URL中的参数,如下所示:
The only way I know to pass parameters in the URL is using the GET method in PHP. But I saw many websites using what seems to be parameters directly in the URL, like this:
http://.../page/2/
在这种情况下,page真的是一个参数吗?如果是这样,代码如何处理?
In this case, is "page" really a parameter? If so, how is it handled in the code?
或者这是位于目录page中的目录2的常规URL?是否意味着每当创建一个新帖子时,该网站都会创建所有页面和相应的目录?
Or is this a regular URL of a directory "2" located in a directory "page"? Would it mean that whenever a new post is created, the website creates all the pages and the corresponding directories?
谢谢
Thanks
推荐答案
这被称为url重写。基本上,这意味着你使用apache模块来重写传入的url到新的url,然后由apache处理。
This is called url rewriting. Basically this means that you use an apache module to rewrite incoming urls to new urls which are then handled by apache
在你的示例 http:// www.test.com/page/2 /
可能被重写为类似于 http://www.test.com/?page=2
。
In your example http://www.test.com/page/2/
is probably rewritten to something like http://www.test.com/?page=2
.
如果您在互联网上搜索Apache URL重写,您将获得足够的结果来解释如何执行此操作。
If you search the internet for Apache URL rewrite you will get enough results explaining how you can do this.
这篇关于在URL中传递参数(不包含php GET)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!