URL 中的问号 (?) 和与号 (&) 是什么意思? [英] What do a question mark (?) and an ampersand (&) mean in a URL?
问题描述
我看到一个这样的链接:
I saw a link like this:
https://www.google.com/recaptcha/api/siteverify?secret=YOUR_SITE_KEY&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']);代码>
我知道它将秘密变量设置为 YOUR_SITE_KEY 并响应 response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']
但是,我不是确定这些符号的含义,即查询字符串中的 ?
和 &
.
I know that it's setting the secret variable to YOUR_SITE_KEY and response to response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']
but, I'm not sure what those symbols means that is, the ?
and &
in the query string.
推荐答案
没有什么是 PHP 特有的.
There isn't really anything there that is particular to PHP.
?
表示查询字符串的开始.在查询字符串中,您有一组 key=value
对,每个对都由 &
分隔.
The ?
indicates the start of the query string. Within the query string you have a set of key=value
pairs, each separated by an &
.
PHP 将使用此数据填充 $_GET
.它是 URL 标准的一部分,任何服务器端语言都会有一个提供类似功能的解析器.
PHP will populate $_GET
with this data. It is part of the URL standard and any server side language will have a parser that provides similar functionality.
这也是浏览器在提交表单时生成的默认数据格式.
This is also the default data format browsers generate when submitting a form.
这篇关于URL 中的问号 (?) 和与号 (&) 是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!