简体   繁体   中英

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.

$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

3.3. HTTP

An HTTP URL takes the form:

  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):

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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