Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.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 查询字符串http%3A%2F%2F变为http%253A%252F%252_Php_Url_Uri_Encode - Fatal编程技术网

Php 查询字符串http%3A%2F%2F变为http%253A%252F%252

Php 查询字符串http%3A%2F%2F变为http%253A%252F%252,php,url,uri,encode,Php,Url,Uri,Encode,我对查询字符串符号有问题 我正在将用户重定向到此链接 payment.php?pg_amount=294.91&pg_check_url=http%3A%2F%2Fofficecorp.ru%2Fplatron%2Fcheck.php&pg_description=order+number+%2339&pg_failure_url=http%3A%2F%2Fofficecorp.ru%2Fplatron%2Ffailure.php&pg_failure_url_m

我对查询字符串符号有问题

我正在将用户重定向到此链接

payment.php?pg_amount=294.91&pg_check_url=http%3A%2F%2Fofficecorp.ru%2Fplatron%2Fcheck.php&pg_description=order+number+%2339&pg_failure_url=http%3A%2F%2Fofficecorp.ru%2Fplatron%2Ffailure.php&pg_failure_url_method=POST&pg_lifetime=86400&pg_merchant_id=4726&pg_order_id=39&pg_refund_url=http%3A%2F%2Fofficecorp.ru%2Fplatron%2Frefund.php&pg_request_method=POST&pg_result_url=http%3A%2F%2Fofficecorp.ru%2Fplatron%2Fresult.php&pg_salt=52ed1c15ce83b&pg_site_url=http%3A%2F%2Fofficecorp.ru&pg_success_url=http%3A%2F%2Fofficecorp.ru%2Fplatron%2Fsuccess.php&pg_success_url_method=AUTOPOST&pg_testing_mode=1&pg_user_contact_email=t.muradyan%40platron.ru&pg_user_mail=t.muradyan%40platron.ru&pg_user_phone=79163763072&status_failed=R&status_ok=D&status_revoked=V&pg_sig=134921022b548f00daed122f8249b003
但是它变成了

https://www.platron.ru/payment.php?pg_amount=294.91&pg_check_url=http%253A%252F%252Fofficecorp.ru%252Fplatron%252Fcheck.php&pg_description=order+number+%252339&pg_failure_url=http%253A%252F%252Fofficecorp.ru%252Fplatron%252Ffailure.php&pg_failure_url_method=POST&pg_lifetime=86400&pg_merchant_id=4726&pg_order_id=39&pg_refund_url=http%253A%252F%252Fofficecorp.ru%252Fplatron%252Frefund.php&pg_request_method=POST&pg_result_url=http%253A%252F%252Fofficecorp.ru%252Fplatron%252Fresult.php&pg_salt=52ed1c15ce83b&pg_site_url=http%253A%252F%252Fofficecorp.ru&pg_success_url=http%253A%252F%252Fofficecorp.ru%252Fplatron%252Fsuccess.php&pg_success_url_method=AUTOPOST&pg_testing_mode=1&pg_user_contact_email=t.muradyan%2540platron.ru&pg_user_mail=t.muradyan%2540platron.ru&pg_user_phone=79163763072&status_failed=R&status_ok=D&status_revoked=V&pg_sig=134921022b548f00daed122f8249b003
字母http%3A%2F%2F将变成http%253A%252F%252

$strQuery = http_build_query($arrRequest);

$strQuery 

pg_amount=294.91&pg_check_url=http%3A%2F%2Fofficecorp.ru%2Fplatron%2Fcheck.php&pg_description=order+number+%2339&pg_failure_url=http%3A%2F%2Fofficecorp.ru%2Fplatron%2Ffailure.php&pg_failure_url_method=POST&pg_lifetime=86400&pg_merchant_id=4726&pg_order_id=39&pg_refund_url=http%3A%2F%2Fofficecorp.ru%2Fplatron%2Frefund.php&pg_request_method=POST&pg_result_url=http%3A%2F%2Fofficecorp.ru%2Fplatron%2Fresult.php&pg_salt=52ed1c15ce83b&pg_site_url=http%3A%2F%2Fofficecorp.ru&pg_success_url=http%3A%2F%2Fofficecorp.ru%2Fplatron%2Fsuccess.php&pg_success_url_method=AUTOPOST&pg_testing_mode=1&pg_user_contact_email=t.muradyan%40platron.ru&pg_user_mail=t.muradyan%40platron.ru&pg_user_phone=79163763072&status_failed=R&status_ok=D&status_revoked=V&pg_sig=134921022b548f00daed122f8249b003

编码有问题。如何修复它?

原因是,
%
-符号被编码(十六进制值为0x25)

您不必手动编码url,只需将您的url(带有所有特殊符号)放入链接中,编码将自动完成

之后代码应如下所示:

$strQuery = http_build_query($arrRequest);

$strQuery 

pg_amount=294.91&pg_check_url=http://officecorp.ru/platron/check.php&pg_description=order number #39&pg_failure_url=http://officecorp.ru/platron/failure.php&pg_failure_url_method=POST&pg_lifetime=86400&pg_merchant_id=4726&pg_order_id=39&pg_refund_url=http://officecorp.ru/platron/refund.php&pg_request_method=POST&pg_result_url=http://officecorp.ru/platron/result.php&pg_salt=52ed1c15ce83b&pg_site_url=http://officecorp.ru&pg_success_url=http://officecorp.ru/platron/success.php&pg_success_url_method=AUTOPOST&pg_testing_mode=1&pg_user_contact_email=t.muradyan@platron.ru&pg_user_mail=t.muradyan@platron.ru&pg_user_phone=79163763072&status_failed=R&status_ok=D&status_revoked=V&pg_sig=134921022b548f00daed122f8249b003