微信支付二维码不显示【PHP大佬进来看看】

59次阅读

共计 1369 个字符,预计需要花费 4 分钟才能阅读完成。

代码如下,url2 获取结果为空,大佬看看哪里的问题啊?

  1. <?php
  2. ini_set(‘date.timezone’,’Asia/Shanghai’);
  3. //error_reporting(E_ERROR);
  4. require_once “../lib/WxPay.Api.php”;
  5. require_once “WxPay.NativePay.php”;
  6. require_once ‘log.php’;
  7. if($_REQUEST[‘WIDout_trade_no’] && $_REQUEST[‘WIDtotal_amount’] && $_REQUEST[‘WIDbody’]){
  8. }else{
  9.     die;
  10. }
  11. $params = array(
  12.     ‘body’ => $_REQUEST[‘WIDbody’],
  13.     ‘out_trade_no’ => $_REQUEST[‘WIDout_trade_no’],
  14.     ‘total_fee’ => $_REQUEST[‘WIDtotal_amount’]*100,
  15.         //’total_fee’ => 1,
  16. );
  17. // 模式二
  18. /**
  19. * 流程:
  20. * 1、调用统一下单,取得 code_url,生成二维码
  21. * 2、用户扫描二维码,进行支付
  22. * 3、支付完成之后,微信服务器会通知支付成功
  23. * 4、在支付成功通知中需要查单确认是否真正支付成功(见:notify.php)
  24. */
  25. $notify = new NativePay();
  26. $input = new WxPayUnifiedOrder();
  27. $input->SetBody($params[‘body’]);
  28. $input->SetAttach($params[‘body’]);
  29. $input->SetOut_trade_no($params[‘out_trade_no’]);
  30. $input->SetTotal_fee($params[‘total_fee’]);
  31. $input->SetTime_start(date(“YmdHis”));
  32. $input->SetTime_expire(date(“YmdHis”, time() + 600));
  33. $input->SetGoods_tag($params[‘body’]);
  34. $input->SetNotify_url(“https://a.com/payment/Wxpay_gz/example/native_callback.php”);
  35. $input->SetTrade_type(“NATIVE”);
  36. $input->SetProduct_id(“123456789”);
  37. $result = $notify->GetPayUrl($input);
  38. $url2 = $result[“code_url”];
  39. ?>

复制代码

网友回复:

注册 找 ai 给你看看啊

igoogle AI 看不懂的吧

vivi 打印一下 $result 就知道了啊

igoogle result 警告,没有输出信息 Warning: urlencode() expects parameter 1 to be string, array given in /www/wwwroot/a.com/payment/Wxpay_gz/example/native.php on line 94

danny、 这不是很明显么,这报错了么

igoogle Google 了下,也没找到适用的解决方法

正文完
 0