直接引进 demo 已经封装好了
include_once “WeixinPay.php”;
$appid = $config[‘appid’];
$mch_id = $config[‘mchid’];
$key = $config[‘key’];
$openid = $openid;
$out_trade_no = input(‘order_id’)."-".time();
$body = ‘商品’;
//$attach = input(‘order_id’);
$total_fee = $order[‘pay_fee’]*100;
$notify_url = ‘http://lbq.sanyuetaoliang.com/api.php/api/notify_sub’;
KaTeX parse error: Undefined control sequence: \WeixinPay at position 17: …eixinPay = new \̲W̲e̲i̲x̲i̲n̲P̲a̲y̲(appid, o p e n i d , openid, openid,mch_id, k e y , key, key,out_trade_no, b o d y , body, body,total_fee,$notify_url);
$result[‘status’] = ‘success’;
$result[‘message’]= $WeixinPay->pay();
return json($result);
demo 下载地址:链接: https://pan.baidu.com/s/13gvl-yN1UPa7JV_DASG09w 提取码: 7aw3