有没有办法转换这个符号 - 在php
$payment_url = "https://www.paypal.com/cgi-bin/webscr";
$currencyCode = get_option('wpoupon_currency');
$countryCode = get_option('wpoupon_country');
$payPalId = get_option('wpoupon_payment_email');
$notifyLink = getPermalink('&mode=notifyurl&user_id='.$current_user->ID,$itemID);
$returnLink = getPermalink('&mode=returnurl',$itemID);
$cancelLink = getPermalink('&mode=cancel',$itemID);
$form_custom = '';
$form_custom .= '<input type="hidden" name="cmd" value="_xclick">';
$form_custom .= '<input type="hidden" name="business" value="'. $payPalId .'">';
$form_custom .= '<input type="hidden" name="item_name" value="'. htmlspecialchars($itemName) .'">';
$form_custom .= '<input type="hidden" name="item_number" value="'. $itemID .'">';
$form_custom .= '<input type="hidden" name="amount" value="'. $itemPrice .'">';
$form_custom .= '<input type="hidden" name="quantity" value="'. $quantity .'">';
$form_custom .= '<input type="hidden" name="currency_code" value="'. $currencyCode .'">';
$form_custom .= '<input type="hidden" name="no_shipping" value="1">';
$form_custom .= '<input type="hidden" name="notify_url" value="'. $notifyLink .'">';
$form_custom .= '<input type="hidden" name="cbt" value="Return to get your Coupon!">';
$form_custom .= '<input type="hidden" name="return" value="'. $returnLink .'">';
$form_custom .= '<input type="hidden" name="rm" value="2">';
$form_custom .= '<input type="hidden" name="cancel_return" value="'. $cancelLink .'">';
$form_custom .= '<input type="hidden" name="lc" value="'. $countryCode .'">';
$form_custom .= '<input type="hidden" name="bn" value="PP-BuyNowBF">';
echo '<form action="'. $payment_url .'" method="post" name="payment" id="payment">'. $form_custom .'</form>';
因为当这个隐藏值提交给paypal时
魅力之美 - 节省51%购买
有没有办法解决这个问题
所以我用
$form_custom .= '<input type="hidden" name="item_name" value="'. htmlspecialchars($itemName) .'">';
now its showing in paypal as **"Charisma Beauty – Save 51% Buy Now"**
答案 0 :(得分:1)
在将数据提交给PayPal之前使用urlencode
。
$form_custom .= '<input type="hidden" name="item_name" value="'. urlencode($itemName) .'">';