GET变量和漂亮的URL [英] GET variables and pretty urls
问题描述
我认为这是一个noob问题,但在这里。
我试图在PHP中更好地理解$ _GET变量。很多CMS等都将site.com/?ID=42这样的东西转换成类似site.com/42的东西。
我的问题是,$ _GET变量会发生什么当这个情况发生时?我尝试在页面加载时打印GET数组,并且它是空的。如果您以这种方式传递参数,不再是GET变量,因为它们不是使用传统的?
GET语法传递的。它们只是URL的一部分,将由您正在使用的CMS框架进行分析。
i think this is a bit of a noob question, but here goes.
I am trying to get a better understanding $_GET variables in PHP. A lot of CMS's etc convert things like site.com/?ID=42 into something like site.com/42
My question is, what happens to the $_GET variables when this happens? I try and print the GET array on page load, and it is empty.
If you pass arguments this way, they will no longer be GET variables as they are not passed using the traditional ?
GET syntax. They are just part of the URL, which will be parsed by the "CMS" framework you are using.
However, if you happened to pass a "traditional" GET variable and want to read it on the server, you would have to consult the CMS's documentation. If the framework is going to use pretty URL's it will probably also remove any GET variables, as they are no longer necessary. For example, the CodeIgniter MVC framework (not a CMS on its own, but may used to build them) does this.
这篇关于GET变量和漂亮的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!