Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

orderquery.php 1.9 KiB

3 år sedan
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <html>
  2. <head>
  3. <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
  4. <meta name="viewport" content="width=device-width, initial-scale=1" />
  5. <title>微信支付样例-订单查询</title>
  6. </head>
  7. <?php
  8. ini_set('date.timezone','Asia/Shanghai');
  9. error_reporting(E_ERROR);
  10. require_once "../lib/WxPay.Api.php";
  11. require_once 'log.php';
  12. //初始化日志
  13. $logHandler= new CLogFileHandler("./logs/".date('Y-m-d').'.log');
  14. $log = Log::Init($logHandler, 15);
  15. function printf_info($data)
  16. {
  17. foreach($data as $key=>$value){
  18. echo "<font color='#f00;'>$key</font> : $value <br/>";
  19. }
  20. }
  21. if(isset($_REQUEST["transaction_id"]) && $_REQUEST["transaction_id"] != ""){
  22. $transaction_id = $_REQUEST["transaction_id"];
  23. $input = new WxPayOrderQuery();
  24. $input->SetTransaction_id($transaction_id);
  25. printf_info(WxPayApi::orderQuery($input));
  26. exit();
  27. }
  28. if(isset($_REQUEST["out_trade_no"]) && $_REQUEST["out_trade_no"] != ""){
  29. $out_trade_no = $_REQUEST["out_trade_no"];
  30. $input = new WxPayOrderQuery();
  31. $input->SetOut_trade_no($out_trade_no);
  32. printf_info(WxPayApi::orderQuery($input));
  33. exit();
  34. }
  35. ?>
  36. <body>
  37. <form action="#" method="post">
  38. <div style="margin-left:2%;color:#f00">微信订单号和商户订单号选少填一个,微信订单号优先:</div><br/>
  39. <div style="margin-left:2%;">微信订单号:</div><br/>
  40. <input type="text" style="width:96%;height:35px;margin-left:2%;" name="transaction_id" /><br /><br />
  41. <div style="margin-left:2%;">商户订单号:</div><br/>
  42. <input type="text" style="width:96%;height:35px;margin-left:2%;" name="out_trade_no" /><br /><br />
  43. <div align="center">
  44. <input type="submit" value="查询" style="width:210px; height:50px; border-radius: 15px;background-color:#FE6714; border:0px #FE6714 solid; cursor: pointer; color:white; font-size:16px;" type="button" onclick="callpay()" />
  45. </div>
  46. </form>
  47. </body>
  48. </html>