Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用url发送特殊字符_Php_Html_Forms_Get - Fatal编程技术网

Php 使用url发送特殊字符

Php 使用url发送特殊字符,php,html,forms,get,Php,Html,Forms,Get,如何从表单提交中获取特殊字符。 例如:一个表单得到了一个name=“customer[firstname]” url将是customer%5Bfirstname%5D=Test。 我试过: $firstName = $_GET['customer[firstname]']; 同样与urldecode,rawurldecode相同。在您的名称属性中使用[…],您正在创建一个数组,您可以通过以下方式在服务器上访问该数组: $firstName = $_GET['customer']['firstn

如何从表单提交中获取特殊字符。 例如:一个表单得到了一个
name=“customer[firstname]”

url将是
customer%5Bfirstname%5D=Test。

我试过:

$firstName = $_GET['customer[firstname]'];

同样与
urldecode,rawurldecode相同。

在您的名称属性中使用
[…]
,您正在创建一个数组,您可以通过以下方式在服务器上访问该数组:

$firstName = $_GET['customer']['firstname'];
如果省略括号中的值,则得到一个数字数组:

name="customer[]"
将在服务器上变为:

// for example, you should really loop over `$_GET['customer']` instead...
$firstName = $_GET['customer'][0]; 

这是关于HTML实体的


看看这里:

你有没有尝试过$\u GET['customer']['firstname']?读一下这个%20是空格,%5B是'[',%5D是']',所以你的url有数组