Php 浏览器对查询字符串进行两次编码
我在重定向期间对查询字符串进行编码时遇到一些问题 参数:Php 浏览器对查询字符串进行两次编码,php,redirect,urlencode,Php,Redirect,Urlencode,我在重定向期间对查询字符串进行编码时遇到一些问题 参数: ( [pg_salt] => 54ed95e0df7f2 [pg_merchant_id] => 6430 [pg_order_id] => 1016156 [PAYMENT_SYSTEM] => Test [pg_lifetime] => 86400 [pg_amount] => 8512.00 [pg_description] => Or
(
[pg_salt] => 54ed95e0df7f2
[pg_merchant_id] => 6430
[pg_order_id] => 1016156
[PAYMENT_SYSTEM] => Test
[pg_lifetime] => 86400
[pg_amount] => 8512.00
[pg_description] => Order ID: 11111
[pg_user_phone] =>
[pg_user_contact_email] => test@test.com
[pg_user_email] => test@test.com
[pg_user_ip] => 11.11.111.111
[pg_request_method] => GET
[pg_success_url_method] => AUTOPOST
[pg_failure_url_method] => AUTOGET
)
然后im通过http\U build\U查询重定向具有标题位置和生成查询字符串的用户
header('Location: https://test.com/test.php?'.http_build_query($arrRequest));
URL如下所示:
http://www.test.com/test.php?pg_salt=54ed91b876393&pg_merchant_id=6430&pg_order_id=1016156&PAYMENT_SYSTEM=Platron&pg_lifetime=86400&pg_amount=8512.00&pg_description=Order+ID%253A+1016156&pg_user_phone=&pg_user_contact_email=test%2540test.com&pg_user_email=test%2540test.com&pg_user_ip=11.11.111.11&pg_request_method=GET&pg_success_url_method=AUTOPOST&pg_failure_url_method=AUTOGET&pg_sig=7351aa0b8607612d85cbd322b4d76803
让我们以电子邮件为例
test%2540test.com
%2540编码为%40(@)
在重定向过程中,为什么像%40(@)这样的符号被编码到%2540,以及如何避免这种情况?对我没有帮助。我不会编码两次。可能问题出在http_build_查询中,函数正在对字符串进行编码,而浏览器对其进行第二次编码。我自己尝试收集查询字符串,没有使用http_build_查询函数,但仍然得到两次编码的sybmols。我怎样才能解决这个问题?