微擎微信支付php,微擎 微信企业付款到用户零钱

目标: 实现企业付款到零钱

步骤

1 下载支付证书

2 配置支付参数 (1 用户微信需要实名认证 2 提现最低要1元)

3 发起支付获取支付结果

企业付款微信官方文档 https://pay.weixin.qq.com/wiki/doc/api/tools/mch_pay.php?chapter=14_1

require_once(dirname(__FILE__)."/pay.php");

//创建一个订单编号字符串,尽量不要重复

public function getordernums(){

$danhao = date('Ymd').substr(implode(NULL, array_map('ord', str_split(substr(uniqid(), 7, 13), 1))), 0, 8);

return $danhao.mt_rand(1000, 9999);

}

1

2

3

4

5

6

require_once(dirname(__FILE__)."/pay.php");

//创建一个订单编号字符串,尽量不要重复

publicfunctiongetordernums(){

$danhao=date('Ymd').substr(implode(NULL,array_map('ord',str_split(substr(uniqid(),7,13),1))),0,8);

return$danhao.mt_rand(1000,9999);

}

public ******{}

$weixinpay=new Pay();

$partner_trade_no=date('Ymd') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT);

$userinfo=mc_oauth_userinfo($_W['uniacid']);

$bonus=1;

$res=$weixinpay->weixin_transfer_money($userinfo['openid'],'',$bonus*100,$partner_trade_no,'抽奖红包');

1

2

3

4

5

6

public******{}

$weixinpay=newPay();

$partner_trade_no=date('Ymd').str_pad(mt_rand(1,99999),5,'0',STR_PAD_LEFT);

$userinfo=mc_oauth_userinfo($_W['uniacid']);

$bonus=1;

$res=$weixinpay->weixin_transfer_money($userinfo['openid'],'',$bonus*100,$partner_trade_no,'抽奖红包');

https://xxxx.com/app/index.php?i=2&c=entry&do=lingqian&m=two_eggs

dirname(dirname(__FILE__));

假设__FILE__为 /home/web/config/config.php

上面的方法输出为 /home/web

dirname(dirname(__FILE__));得到的是文件上一层目录名

dirname(__FILE__);得到的是文件所在层目录名

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值