开发者

Paypal Buy Now Url - PHP

I wrote this to create Buynow button urls, but the url isn't coming out correctly.

It has something to do with imploding the array.. I guess

The problem is occurring here:

amount=10.00¤cy_code=USD

<?php
#
#   Paypal Buynow Button Url
#

$params = array(
    'cmd'       => '_xclick',
    'business'  => 'someone@gmail.com',
    'item_name' => 'Product',
    'amount'    => '10.00',
    'currency_code' => 'USD',
    'return' => 'http://www.stacko开发者_JAVA百科verflow.com',
);

$encoded_params = array();

foreach ($params as $k => $v){

    $encoded_params[] = $k.'='.urlencode($v);
}

echo $url = "https://www.paypal.com/cgi-bin/webscr?".implode('&', $encoded_params);

?>


&curren; is an HTML special character. If you are echoing to an HTML page, when you implode, use implode('&amp;',$encoded_params).

That should fix the issue.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜