我有一个基本的PHP paypal脚本,工作正常(我在沙盒上工作)
我的问题是我从paypal得到的回复是不可读的,因此无法用来做我想要的事情,即更新我的数据库
这是我得到的:
Array
(
[TOKEN] => EC%xxxxx0T
[BILLINGAGREEMENTACCEPTEDSTATUS] => 0
[CHECKOUTSTATUS] => PaymentActionCompleted
[TIMESTAMP] => 2015%2d05%2d15T08%3a23%3a58Z
[ACK] => Success
[VERSION] => 109%2e0
[BUILD] => 16684246
[EMAIL] => mymail%40gmail%2ecom
[PAYERSTATUS] => verified
[FIRSTNAME] => myfname
[LASTNAME] => mylname
[COUNTRYCODE] => US
[SHIPTONAME] => fname%20lname
[SHIPTOSTREET] => 1%20Main%20St
[SHIPTOCITY] => San%20Jose
[SHIPTOSTATE] => CA
[SHIPTOZIP] => 95131
[SHIPTOCOUNTRYCODE] => US
[SHIPTOCOUNTRYNAME] => United%20States
[ADDRESSSTATUS] => Confirmed
[CURRENCYCODE] => USD
[AMT] => 96%2e00
.........
如图所示我获得了上述响应,例如,我无法以如下格式将时间戳存储在数据库中: [TIMESTAMP] => 2015%2d05%2d15T08%3a23%3a58Z 或这样的电子邮件: [EMAIL] => mymail%40gmail%2ecom
我尝试过像这样使用utf8:
header('Content-Type: text/html; charset=utf-8');
但它似乎没有帮助
如何将我从paypal收到的响应解码为友好的可读格式?
答案 0 :(得分:0)
您必须使用urldecode()
功能。
例如:
$data = "mymail%40gmail%2ecom";
echo urldecode($data);
输出:
mymail@gmail.com