?php
include_once 'WxTransfers.Api.php';
class WxTransfers{
public function index(){
$path = WxTransfersConfig::getRealPath(); // 证书文件路径
$config['wxappid'] = WxTransfersConfig::APPID;
$config['mch_id'] = WxTransfersConfig::MCHID;
$config['key'] = WxTransfersConfig::KEY;
$config['PARTNERKEY'] = WxTransfersConfig::KEY;
$config['api_cert'] = $path . WxTransfersConfig::SSLCERT_PATH;
$config['api_key'] = $path . WxTransfersConfig::SSLKEY_PATH;
$config['rootca'] = $path . WxTransfersConfig::SSLROOTCA;
$wxtran=new WxTransfersAPI($config);
$wxtran->setLogFile('D:\\transfers.log');//日志地址
//转账
$data=array(
'openid'=>'****************',//openid
'check_name'=>'NO_CHECK',//是否验证真实姓名参数
're_user_name'=>'******',//姓名
'amount'=>100,//最小1元 也就是100
'desc'=>'企业转账测试',//描述
'spbill_create_ip'=>$wxtran->getServerIp(),//服务器IP地址
);
echo $wxtran->transfers($data);
}
}