2017-06-19 30 views
0

我有两个文件的index.php和success.php这样的:为什么PayPal会重定向到无查询字符串的页面?

enter image description here

的index.php包含:

<!DOCTYPE html> 
 
<html> 
 
    <head> 
 
    <meta charset="utf-8"> 
 
    <title>Paypal test</title> 
 
    </head> 
 
    <body> 
 
    
 
     <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> 
 
     <input type="hidden" name="business" value="[email protected]"> 
 
     <input type="hidden" name="cmd" value="_xclick"> 
 
     <input type="hidden" name="item_name" value="item"> 
 
     <input type="hidden" name="amount" value="1"> 
 
     <input type="hidden" name="currency_code" value="USD"> 
 
     <input type="hidden" name="return" value="http://localhost/paypal/success.php"> 
 
     <button type="submit">pay now</button> 
 
     </form> 
 

 
    </body> 
 
</html>

和success.php包含:

<?php print_r($_POST); ?> 

当我点击“pay now”按钮时,它会转到PayPa l,但交易成功后,重定向没有查询字符串像这样success.php:

enter image description here

为什么会出现在返回页面中没有查询字符串?

+0

我解决后测试:我登录到我的沙箱帐户 - >配置文件 - >我的销售工具 - >网站首选项(更新) - >返回URL并设置我的返回页面url。在此之后,它的工作将 – zuhair

回答

0
<!DOCTYPE html> 
    <html> 
    <head> 
    <meta charset="utf-8"> 
    <title>Paypal test</title> 
    </head> 
    <body> 

    <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> 
    <input type="hidden" name="business" value="zuhair.53957- 
    [email protected]"> 
    <input type="hidden" name="cmd" value="_xclick"> 
    <input type="hidden" name="item_name" value="item"> 
    <input type="hidden" name="amount" value="1"> 
    <input type="hidden" name="currency_code" value="USD"> 
    <input type="hidden" name="return" 
    value="http://localhost/paypal/success.php"> 
    <input type="hidden" name="rm" value="1"> 
    <button type="submit">pay now</button> 
    </form> 

    </body> 
</html> 

我已经添加了rm的值,您可以参考the values here

rm表示返回方法。 FORM METHOD用于将数据发送到由返回变量指定的URL。

有效值是:

  1. 所有的购物车付款使用GET方法。
  2. 买方的浏览器使用GET方法重定向到返回URL,但不包含付款变量。
  3. 买方的浏览器使用POST方法重定向到返回URL,并包含所有支付变量。
+0

我试过你的代码,但是这出现了:事情目前似乎没有工作。请稍后再试。 – zuhair

+0

尝试更改本地主机url为: /paypal/success.php”> – Ali

+0

我改为ip,然后I在真实的网站上试用过。但同样的问题依然存在。 – zuhair

相关问题