加号解码为 space

Plus sign decoded into space

我从 ios 和 android 向某些 PHP 服务器发送请求,但 GET 请求中的某些参数被错误解码。

request: http://myserver.com/path?email=john+doe

$_GET['email'] == 'john doe' instead of 'john+doe'
$this->request->get('email') == 'john doe' instead of 'john+doe'

显然 php(我使用的是 phalcon)正在使用 urldecode 并将 + 替换为 1 space。

如何避免这种情况?我可以相应地更改编码类型和 "Content-Type" header 吗?

are wrongly decoded

它们正确解码。

Can I change the type of enconding and "Content-Type" header accordingly?

没有。 Content-Type header 描述了请求的格式 body,而不是查询字符串。

您应该首先正确编码查询字符串中的数据。

一个+符号应该表示为%2B.

如果您确实需要 PHP 文件中的“+”符号,您可能需要将“+”设为“%2B”。

阅读你提到的值没有错。