我在重定向过程中遇到编码查询字符串的麻烦。
PARAMS:
(
[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
)
然后使用标题位置重定向用户并通过http_build_query
构建查询字符串header('Location: https://test.com/test.php?'.http_build_query($arrRequest));
网址看起来像这样:
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以及如何避免这种情况?