简体   繁体   English

什么事 在php中读取和解释URL时的意思

[英]What does ? mean in php when reading and interpreting a URL

My system works flawlessly, my questions is mainly academic. 我的系统运行正常,我的问题主要是学术性的。

Here is my situation. 这是我的情况。 I built a helpdesk for this company. 我为此公司建立了一个服务台。

The helpdesk simulates URL's by adding a 服务台通过添加一个

~.php?id=123

I can get the value from the id in that URL by using the superglobal GET and then showing the right solution according to the ID displayed on the URL. 我可以使用超全局GET从该URL中的id中获取值,然后根据URL上显示的ID显示正确的解决方案。

$value_of_id = $_GET('id');

I never understood though, what does the question mark in the url below mean. 不过,我从未理解,以下网址中的问号是什么意思。

http://myhost.php?id=123-abc

If anybody that knows the theory well can explain me what that is, I would appreciate it a lot. 如果任何一个非常了解该理论的人都能解释我的意思,我将不胜感激。

http://www.ietf.org/rfc/rfc1738.txt http://www.ietf.org/rfc/rfc1738.txt

3.3. 3.3。 HTTP HTTP

An HTTP URL takes the form: HTTP URL的形式为:

  http://<host>:<port>/<path>?<searchpart>

... ...

   Within the <path> and <searchpart> components, "/", ";", "?" are
   reserved.  The "/" character may be used within HTTP to designate a
   hierarchical structure.

So as others mentioned it is only a reserved separator there. 因此,正如其他人提到的那样,它只是保留的分隔符。

This document updates the above (as DaveRandom mentions): 本文档更新了以上内容(如DaveRandom所述):

http://tools.ietf.org/html/rfc3986#section-3.4 http://tools.ietf.org/html/rfc3986#section-3.4

But I think the point is the same, and it is harder to quote from this newer version. 但是我认为要说的是一样的,因此很难引用这个较新的版本。 :) :)

它是资源(PHP文档)和参数字符串之间的分隔符。

It is only used to separate the URL from the query string. 它仅用于将URL与查询字符串分开。 Since you can't separate it using a slash (beacuse it would have been a folder) it has been decided to use the question tag. 由于您不能使用斜杠将其分开(因为它本来是一个文件夹),因此已决定使用问题标记。 I don't think it has got a grate importance as a symbol. 我认为它没有作为标志的重要性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM