urlencode()将查询中变量的一部分编码为¬

时间:2014-01-07 09:20:32

标签: php urlencode

我有这种奇怪的行为,其中网址中的&notify_url=xxx变为&¬ify_url=xxx

如何阻止这种情况发生?

值字符串已经过url编码。

提前致谢。

//编辑: 完整网址:https://domain.com/eng/process?merchant_id=xxx&merchant_key=xxx&return_url=http%3A%2F%2FdomainX.com%2Fdev%2Fxxx%2Findex.php%3Foption%3Dcom_content%26view%3Darticle%26id%3D62%26Itemid%3D259%26payment_success%3D1&cancel_url=http%3A%2F%2FdomainX.com%2Fdev%2Fsacnasp%2Findex.php%3Foption%3Dcom_content%26view%3Darticle%26id%3D62%26Itemid%3D259%26payment_success%3D-1¬ify_url= http%3A%2F%2Flightside.co.za%2Fdev%2Fsacnasp%2Fpayfast%2Fitn.php& name_first = YYYY& email_address = xxx%40domainX.com& m_payment_id = YYYY_857& amount = 4500.00&安培; ITEM_NAME = YYYY +应用+费&安培; email_confirmation = 1&安培; confirmation_address = YYYY%40domainX.com

//创建网址的代码:

$data = array(
    // Merchant details
    'merchant_id' => $form->data['merchant_id'],
    'merchant_key' => $form->data['merchant_key'],
    'return_url' => $form->data['return_url'],
    'cancel_url' => $form->data['cancel_url'],
    'notify_url' => $form->data['notify_url'],
    'name_first' => $form->data['name_first'],
    'email_address' => $form->data['email_address'],
    'm_payment_id' => $form->data['m_payment_id'],
    'amount' => $form->data['amount'],
    'item_name' => $form->data['item_name'],
    'email_confirmation' => $form->data['email_confirmation'],
    'confirmation_address' => $form->data['confirmation_address'],
);

// Create GET string
foreach ($data as $key => $val) {
    if (!empty($val)) {
        $pfOutput .= $key . '=' . urlencode(trim($val)) . '&';
    }
}
// Remove last ampersand
$getString = substr($pfOutput, 0, -1);

0 个答案:

没有答案