php支付宝手机网页支付类实例
程序员文章站
2022-05-26 12:13:56
本文实例讲述了php支付宝手机网页支付类。分享给大家供大家参考。具体分析如下:
此处注意:
① 该类是用在yii框架里面的,没有去掉一些框架的东西。
② 本类不能不做...
本文实例讲述了php支付宝手机网页支付类。分享给大家供大家参考。具体分析如下:
此处注意:
① 该类是用在yii框架里面的,没有去掉一些框架的东西。
② 本类不能不做任何修改而使用。
1. php代码部分如下:
复制代码 代码如下:
<?php
namespace weixin\components;
use yii;
/**
* 支付宝手机网页支付
*
* @example
* 创建支付请求
* $params = []; //支付宝文档中所需的全部参数
* $alipay = new alipay();
* $alipay->key = ''; //交易安全校验码
* $this->alipay->alipay_config = $params;
* $alipay->buildrequest();
*
* 验证异步通知
* $this->alipay->key = ''; //交易安全校验码
* $this->alipay->alipay_config = $data; //支付宝异步通知参数
* $this->alipay->verifynotify();
*
* @package alipay
* @author dyllen
* @since version 0.2
*/
class alipay {
/**
* 交易安全校验码
*
* @access public
* @var string
*/
public $key;
/**
* 请求参数配置,支付宝接口文档中所需的参数
*
* @access public
* @var array
*/
public $alipay_config=[];
/**
* https证书,用于curl
* 默认和本类文件同级目录的cacert.pem文件
*
* @access public
* @var string
*/
public $credential;
public $notify_data = null;
/**
* 支付宝即时到账网关地址
*/
const alipay_gateway = 'https://mapi.alipay.com/gateway.do?';
/**
* https形式消息验证地址
*/
const https_verify_url = 'https://mapi.alipay.com/gateway.do?service=notify_verify&';
/**
* http形式消息验证地址
*/
const http_verify_url = 'http://notify.alipay.com/trade/notify_query.do?';
/**
* 移动网页支付网关
* @var string
*/
const alipay_page_gateway = 'http://wappaygw.alipay.com/service/rest.htm?';
/**
* 创建支付包即时到账请求url
*
* @access public
* @return void
*/
public function buildrequest() {
$this->alipay_config['sign'] = $this->signdata();
return self::alipay_gateway . $this->createquerystring('', true);
}
/**
* 创建支付宝手机网页支付链接
* @return string
*/
public function buildpageurl()
{
$this->alipay_config['sign'] = $this->signdata();
$url = self::alipay_page_gateway. $this->createquerystring('');
$response = $this->gethttpresponseget($url);
$res = $this->parseresponse(trim($response));
//重新组合支付请求参数
$this->alipay_config['service'] = 'alipay.wap.auth.authandexecute';
$this->alipay_config['req_data'] = '<auth_and_execute_req><request_token>'.$res['request_token'].'</request_token></auth_and_execute_req>';
$this->alipay_config['sign'] = $this->signdata();
return self::alipay_page_gateway. $this->createquerystring('', true);
}
/**
* 验证支付宝异步通知参数合法性
*
* @access public
* @return boolean
*/
public function verifynotify() {
$param_tmp = $this->filter(); //过滤待签名数据
if(!isset($this->alipay_config['notify_data'])) {
return false;
}
$this->notify_data = $this->xmltoarray($this->alipay_config['notify_data']);
$this->alipay_config['notify_id'] = $this->notify_data['notify_id'];
$responsetxt = 'true';
if( !empty( $this->alipay_config['notify_id'] ) ) {
$responsetxt = $this->getresponse();
}
unset($this->alipay_config['notify_id']);
$txt = 'service=';
$txt .= $this->alipay_config['service'];
$txt .= '&v='.$this->alipay_config['v'];
$txt .= '&sec_id='.$this->alipay_config['sec_id'];
$txt .= '¬ify_data='.$this->alipay_config['notify_data'];
$txt .= $this->key;
$sign = md5($txt);
if ( preg_match("/true$/i",$responsetxt) && ($sign == $this->alipay_config['sign']) ) {
return true;
} else {
return false;
}
}
/**
* 解析授权接口返回
* @param string $content 授权接口返回的文本数据
* @throws \exception
* @return array
*/
private function parseresponse($content) {
parse_str($content, $arr);
$data = isset($arr['res_data']) ? $arr['res_data'] : $arr['res_error'];
$res_data = simplexml_load_string($data);
if(strlen($res_data->request_token) == 0 || strlen($res_data->msg) > 0) {
throw new \exception('code:'.$res_data->code.','.$res_data->msg);
}
$arr['request_token'] = $res_data->request_token->__tostring();
return $arr;
}
/**
* simplexml对象转成数组
* @param string $xml
* @return multitype:null
*/
private function xmltoarray($xml)
{
$xml_obj = simplexml_load_string($xml, 'simplexmliterator');
$arr = [];
$xml_obj->rewind(); //指针指向第一个元素
while (1) {
if( ! is_object($xml_obj->current()) )
{
break;
}
$arr[$xml_obj->key()] = $xml_obj->current()->__tostring();
$xml_obj->next(); //指向下一个元素
}
return $arr;
}
/**
* 签名数据
* 签名规则:
* sign和sign_type不参加签名,需要去掉
* 对参数数组依据键名按照字母顺序升序排序
* 排序完成之后键值对用&字符连接,组成url的查询字符串形式待签名字符串,待签名数据不需用url encoding
* md5签名:私钥拼接到待签名字符串的后面,然后用md5对字符串运算,得到32位签名结果
*
* @return string 已签名数据
*/
private function signdata() {
$param_tmp = $this->getsignstring(); //待签名字符串
if( !isset($this->key) ) {
return false;
}
$sign = '';
//签名数据
switch ($this->alipay_config['sec_id']) {
case '001': //rsa
$sign = $this->rsasign($param_tmp);
break;
case 'des':
break;
default:
$sign = $this->md5sign($param_tmp);
}
return $sign;
}
/**
* md5加密字符串
*
* @access private
* @param string $data 待加密字符串
* @return string
*/
private function md5sign( $data ) {
return md5($data . $this->key);
}
/**
* rsa 加密字符串
*
* @param string $data 待加密字符串
* @return string
*/
private function rsasign( $data ) {
return false;
}
/**
* 获得待签名数据
*
* @access private
* @return string
*/
private function getsignstring() {
$param_tmp = $this->filter(); //过滤待签名数据
//排序
ksort($param_tmp);
reset($param_tmp);
//创建查询字符串形式的待签名数据
return $this->createquerystring($param_tmp);
}
/**
* 过滤待签名数据,去掉sing、sing_type及空值
*
* @access private
* @return array
*/
private function filter() {
$para_filter = array();
foreach($this->alipay_config as $key => $value){
if($key == "sign" || $key == "sign_type" || empty($value)) continue;
else $para_filter[$key] = $value;
}
return $para_filter;
}
/**
* 用&拼接字符串,形成url查询字符串
*
* @access private
* @param array $data
* @param boolean $is_encode 是否对值做urlencode
* @return string
*/
private function createquerystring($data=null, $is_encode=false ) {
$arr = empty($data) ? $this->alipay_config : $data;
$arg = '';
foreach( $arr as $key => $value ) {
if($is_encode) {
$key = urlencode($key);
$value = urlencode($value);
}
$arg .= $key . '=' . $value . '&';
}
$arg = substr($arg, 0, strlen($arg)-1); //去掉最后一个&
//如果存在转义字符,那么去掉转义
if(get_magic_quotes_gpc()) {$arg = stripslashes($arg);}
return $arg;
}
/**
* 获取远程服务器atn结果,验证返回url
*
* 验证结果集:
* invalid命令参数不对 出现这个错误,请检测返回处理中partner和key是否为空
* true 返回正确信息
* false 请检查防火墙或者是服务器阻止端口问题以及验证时间是否超过一分钟
*
* @access private
* @return 服务器atn结果
*/
private function getresponse() {
//载入支付配置
$config = yii::$app->params['alipay'];
$transport = strtolower(trim($config['transport']));
$partner = trim($config['partner']);
$veryfy_url = '';
if($transport == 'https') {
$veryfy_url = self::https_verify_url;
}
else {
$veryfy_url = self::http_verify_url;
}
$veryfy_url = $veryfy_url."partner=" . $partner . "¬ify_id=" . $this->alipay_config['notify_id'];
$responsetxt = $this->gethttpresponseget($veryfy_url);
return $responsetxt;
}
/**
* 取证书,用于curl的请求
*
* @access private
* @return string 证书路径
*/
private function getcr() {
if( ! empty($this->credential) ) {
return $this->credential;
}
return __dir__ . directory_separator .'cacert.pem';
}
/**
* 远程获取数据,post模式
* 注意:
* 1.使用crul需要修改服务器中php.ini文件的设置,找到php_curl.dll去掉前面的";"就行了
* 2.文件夹中cacert.pem是ssl证书请保证其路径有效,目前默认路径是:getcwd().'\\cacert.pem'
*
* @param $url 指定url完整路径地址
* @param $cacert_url 指定当前工作目录绝对路径
* @param $para 请求的数据
* @param $input_charset 编码格式。默认值:空值
* return 远程输出的数据
*/
private function gethttpresponsepost($url, $para, $input_charset = '') {
if (trim($input_charset) != '') {
$url = $url."_input_charset=".$input_charset;
}
$curl = curl_init($url);
curl_setopt($curl, curlopt_ssl_verifypeer, true);//ssl证书认证
curl_setopt($curl, curlopt_ssl_verifyhost, 2);//严格认证
curl_setopt($curl, curlopt_cainfo,$this->getcr());//证书地址
curl_setopt($curl, curlopt_header, 0 ); // 过滤http头
curl_setopt($curl, curlopt_returntransfer, 1);// 显示输出结果
curl_setopt($curl, curlopt_post,true); // post传输数据
curl_setopt($curl, curlopt_postfields,$para);// post传输数据
$responsetext = curl_exec($curl);
//var_dump( curl_error($curl) );//如果执行curl过程中出现异常,可打开此开关,以便查看异常内容
curl_close($curl);
return $responsetext;
}
/**
* 远程获取数据,get模式
* 注意:
* 1.使用crul需要修改服务器中php.ini文件的设置,找到php_curl.dll去掉前面的";"就行了
* 2.文件夹中cacert.pem是ssl证书请保证其路径有效,目前默认路径是:getcwd().'\\cacert.pem'
*
* @param $url 指定url完整路径地址
* @param $cacert_url 指定当前工作目录绝对路径
* return 远程输出的数据
*/
private function gethttpresponseget($url) {
$curl = curl_init($url);
curl_setopt($curl, curlopt_header, 0 ); // 过滤http头
curl_setopt($curl, curlopt_returntransfer, 1);// 显示输出结果
curl_setopt($curl, curlopt_ssl_verifypeer, true);//ssl证书认证
curl_setopt($curl, curlopt_ssl_verifyhost, 2);//严格认证
curl_setopt($curl, curlopt_cainfo,$this->getcr());//证书地址
$responsetext = curl_exec($curl);
//var_dump( curl_error($curl) );exit;//如果执行curl过程中出现异常,可打开此开关,以便查看异常内容
curl_close($curl);
return $responsetext;
}
}
namespace weixin\components;
use yii;
/**
* 支付宝手机网页支付
*
* @example
* 创建支付请求
* $params = []; //支付宝文档中所需的全部参数
* $alipay = new alipay();
* $alipay->key = ''; //交易安全校验码
* $this->alipay->alipay_config = $params;
* $alipay->buildrequest();
*
* 验证异步通知
* $this->alipay->key = ''; //交易安全校验码
* $this->alipay->alipay_config = $data; //支付宝异步通知参数
* $this->alipay->verifynotify();
*
* @package alipay
* @author dyllen
* @since version 0.2
*/
class alipay {
/**
* 交易安全校验码
*
* @access public
* @var string
*/
public $key;
/**
* 请求参数配置,支付宝接口文档中所需的参数
*
* @access public
* @var array
*/
public $alipay_config=[];
/**
* https证书,用于curl
* 默认和本类文件同级目录的cacert.pem文件
*
* @access public
* @var string
*/
public $credential;
public $notify_data = null;
/**
* 支付宝即时到账网关地址
*/
const alipay_gateway = 'https://mapi.alipay.com/gateway.do?';
/**
* https形式消息验证地址
*/
const https_verify_url = 'https://mapi.alipay.com/gateway.do?service=notify_verify&';
/**
* http形式消息验证地址
*/
const http_verify_url = 'http://notify.alipay.com/trade/notify_query.do?';
/**
* 移动网页支付网关
* @var string
*/
const alipay_page_gateway = 'http://wappaygw.alipay.com/service/rest.htm?';
/**
* 创建支付包即时到账请求url
*
* @access public
* @return void
*/
public function buildrequest() {
$this->alipay_config['sign'] = $this->signdata();
return self::alipay_gateway . $this->createquerystring('', true);
}
/**
* 创建支付宝手机网页支付链接
* @return string
*/
public function buildpageurl()
{
$this->alipay_config['sign'] = $this->signdata();
$url = self::alipay_page_gateway. $this->createquerystring('');
$response = $this->gethttpresponseget($url);
$res = $this->parseresponse(trim($response));
//重新组合支付请求参数
$this->alipay_config['service'] = 'alipay.wap.auth.authandexecute';
$this->alipay_config['req_data'] = '<auth_and_execute_req><request_token>'.$res['request_token'].'</request_token></auth_and_execute_req>';
$this->alipay_config['sign'] = $this->signdata();
return self::alipay_page_gateway. $this->createquerystring('', true);
}
/**
* 验证支付宝异步通知参数合法性
*
* @access public
* @return boolean
*/
public function verifynotify() {
$param_tmp = $this->filter(); //过滤待签名数据
if(!isset($this->alipay_config['notify_data'])) {
return false;
}
$this->notify_data = $this->xmltoarray($this->alipay_config['notify_data']);
$this->alipay_config['notify_id'] = $this->notify_data['notify_id'];
$responsetxt = 'true';
if( !empty( $this->alipay_config['notify_id'] ) ) {
$responsetxt = $this->getresponse();
}
unset($this->alipay_config['notify_id']);
$txt = 'service=';
$txt .= $this->alipay_config['service'];
$txt .= '&v='.$this->alipay_config['v'];
$txt .= '&sec_id='.$this->alipay_config['sec_id'];
$txt .= '¬ify_data='.$this->alipay_config['notify_data'];
$txt .= $this->key;
$sign = md5($txt);
if ( preg_match("/true$/i",$responsetxt) && ($sign == $this->alipay_config['sign']) ) {
return true;
} else {
return false;
}
}
/**
* 解析授权接口返回
* @param string $content 授权接口返回的文本数据
* @throws \exception
* @return array
*/
private function parseresponse($content) {
parse_str($content, $arr);
$data = isset($arr['res_data']) ? $arr['res_data'] : $arr['res_error'];
$res_data = simplexml_load_string($data);
if(strlen($res_data->request_token) == 0 || strlen($res_data->msg) > 0) {
throw new \exception('code:'.$res_data->code.','.$res_data->msg);
}
$arr['request_token'] = $res_data->request_token->__tostring();
return $arr;
}
/**
* simplexml对象转成数组
* @param string $xml
* @return multitype:null
*/
private function xmltoarray($xml)
{
$xml_obj = simplexml_load_string($xml, 'simplexmliterator');
$arr = [];
$xml_obj->rewind(); //指针指向第一个元素
while (1) {
if( ! is_object($xml_obj->current()) )
{
break;
}
$arr[$xml_obj->key()] = $xml_obj->current()->__tostring();
$xml_obj->next(); //指向下一个元素
}
return $arr;
}
/**
* 签名数据
* 签名规则:
* sign和sign_type不参加签名,需要去掉
* 对参数数组依据键名按照字母顺序升序排序
* 排序完成之后键值对用&字符连接,组成url的查询字符串形式待签名字符串,待签名数据不需用url encoding
* md5签名:私钥拼接到待签名字符串的后面,然后用md5对字符串运算,得到32位签名结果
*
* @return string 已签名数据
*/
private function signdata() {
$param_tmp = $this->getsignstring(); //待签名字符串
if( !isset($this->key) ) {
return false;
}
$sign = '';
//签名数据
switch ($this->alipay_config['sec_id']) {
case '001': //rsa
$sign = $this->rsasign($param_tmp);
break;
case 'des':
break;
default:
$sign = $this->md5sign($param_tmp);
}
return $sign;
}
/**
* md5加密字符串
*
* @access private
* @param string $data 待加密字符串
* @return string
*/
private function md5sign( $data ) {
return md5($data . $this->key);
}
/**
* rsa 加密字符串
*
* @param string $data 待加密字符串
* @return string
*/
private function rsasign( $data ) {
return false;
}
/**
* 获得待签名数据
*
* @access private
* @return string
*/
private function getsignstring() {
$param_tmp = $this->filter(); //过滤待签名数据
//排序
ksort($param_tmp);
reset($param_tmp);
//创建查询字符串形式的待签名数据
return $this->createquerystring($param_tmp);
}
/**
* 过滤待签名数据,去掉sing、sing_type及空值
*
* @access private
* @return array
*/
private function filter() {
$para_filter = array();
foreach($this->alipay_config as $key => $value){
if($key == "sign" || $key == "sign_type" || empty($value)) continue;
else $para_filter[$key] = $value;
}
return $para_filter;
}
/**
* 用&拼接字符串,形成url查询字符串
*
* @access private
* @param array $data
* @param boolean $is_encode 是否对值做urlencode
* @return string
*/
private function createquerystring($data=null, $is_encode=false ) {
$arr = empty($data) ? $this->alipay_config : $data;
$arg = '';
foreach( $arr as $key => $value ) {
if($is_encode) {
$key = urlencode($key);
$value = urlencode($value);
}
$arg .= $key . '=' . $value . '&';
}
$arg = substr($arg, 0, strlen($arg)-1); //去掉最后一个&
//如果存在转义字符,那么去掉转义
if(get_magic_quotes_gpc()) {$arg = stripslashes($arg);}
return $arg;
}
/**
* 获取远程服务器atn结果,验证返回url
*
* 验证结果集:
* invalid命令参数不对 出现这个错误,请检测返回处理中partner和key是否为空
* true 返回正确信息
* false 请检查防火墙或者是服务器阻止端口问题以及验证时间是否超过一分钟
*
* @access private
* @return 服务器atn结果
*/
private function getresponse() {
//载入支付配置
$config = yii::$app->params['alipay'];
$transport = strtolower(trim($config['transport']));
$partner = trim($config['partner']);
$veryfy_url = '';
if($transport == 'https') {
$veryfy_url = self::https_verify_url;
}
else {
$veryfy_url = self::http_verify_url;
}
$veryfy_url = $veryfy_url."partner=" . $partner . "¬ify_id=" . $this->alipay_config['notify_id'];
$responsetxt = $this->gethttpresponseget($veryfy_url);
return $responsetxt;
}
/**
* 取证书,用于curl的请求
*
* @access private
* @return string 证书路径
*/
private function getcr() {
if( ! empty($this->credential) ) {
return $this->credential;
}
return __dir__ . directory_separator .'cacert.pem';
}
/**
* 远程获取数据,post模式
* 注意:
* 1.使用crul需要修改服务器中php.ini文件的设置,找到php_curl.dll去掉前面的";"就行了
* 2.文件夹中cacert.pem是ssl证书请保证其路径有效,目前默认路径是:getcwd().'\\cacert.pem'
*
* @param $url 指定url完整路径地址
* @param $cacert_url 指定当前工作目录绝对路径
* @param $para 请求的数据
* @param $input_charset 编码格式。默认值:空值
* return 远程输出的数据
*/
private function gethttpresponsepost($url, $para, $input_charset = '') {
if (trim($input_charset) != '') {
$url = $url."_input_charset=".$input_charset;
}
$curl = curl_init($url);
curl_setopt($curl, curlopt_ssl_verifypeer, true);//ssl证书认证
curl_setopt($curl, curlopt_ssl_verifyhost, 2);//严格认证
curl_setopt($curl, curlopt_cainfo,$this->getcr());//证书地址
curl_setopt($curl, curlopt_header, 0 ); // 过滤http头
curl_setopt($curl, curlopt_returntransfer, 1);// 显示输出结果
curl_setopt($curl, curlopt_post,true); // post传输数据
curl_setopt($curl, curlopt_postfields,$para);// post传输数据
$responsetext = curl_exec($curl);
//var_dump( curl_error($curl) );//如果执行curl过程中出现异常,可打开此开关,以便查看异常内容
curl_close($curl);
return $responsetext;
}
/**
* 远程获取数据,get模式
* 注意:
* 1.使用crul需要修改服务器中php.ini文件的设置,找到php_curl.dll去掉前面的";"就行了
* 2.文件夹中cacert.pem是ssl证书请保证其路径有效,目前默认路径是:getcwd().'\\cacert.pem'
*
* @param $url 指定url完整路径地址
* @param $cacert_url 指定当前工作目录绝对路径
* return 远程输出的数据
*/
private function gethttpresponseget($url) {
$curl = curl_init($url);
curl_setopt($curl, curlopt_header, 0 ); // 过滤http头
curl_setopt($curl, curlopt_returntransfer, 1);// 显示输出结果
curl_setopt($curl, curlopt_ssl_verifypeer, true);//ssl证书认证
curl_setopt($curl, curlopt_ssl_verifyhost, 2);//严格认证
curl_setopt($curl, curlopt_cainfo,$this->getcr());//证书地址
$responsetext = curl_exec($curl);
//var_dump( curl_error($curl) );exit;//如果执行curl过程中出现异常,可打开此开关,以便查看异常内容
curl_close($curl);
return $responsetext;
}
}
2. 使用方法:
复制代码 代码如下:
//授权接口请求参数
$sum = 0.01; //测试用金额
$req_data = '<direct_trade_create_req><subject>充值</subject>';
$req_data .= '<out_trade_no>'.$orderno.'</out_trade_no>';
$req_data .= '<total_fee>'.$sum.'</total_fee>';
$req_data .= '<call_back_url>'.url::toroute(['payment/return'], true).'</call_back_url>';
$req_data .= '<notify_url>'.url::toroute(['payment/notify'], true).'</notify_url>';
$req_data .= '<seller_account_name>'.yii::$app->params['alipay']['seller_email'].'</seller_account_name>';
$req_data .= '</direct_trade_create_req>';
$params = [
'service' => 'alipay.wap.trade.create.direct',
'format' => 'xml',
'v' => '2.0',
'partner' => yii::$app->params['alipay']['partner'], //合作者省份id
'req_id' => date('ymdhis'),
'sec_id' => yii::$app->params['alipay']['sign_type'],
'req_data' => $req_data,
];
$alipay = new alipay();
$alipay->key = yii::$app->params['alipay']['key'];
$alipay->alipay_config = $params;
$url = $alipay->buildpageurl();
$this->redirect($url);
$sum = 0.01; //测试用金额
$req_data = '<direct_trade_create_req><subject>充值</subject>';
$req_data .= '<out_trade_no>'.$orderno.'</out_trade_no>';
$req_data .= '<total_fee>'.$sum.'</total_fee>';
$req_data .= '<call_back_url>'.url::toroute(['payment/return'], true).'</call_back_url>';
$req_data .= '<notify_url>'.url::toroute(['payment/notify'], true).'</notify_url>';
$req_data .= '<seller_account_name>'.yii::$app->params['alipay']['seller_email'].'</seller_account_name>';
$req_data .= '</direct_trade_create_req>';
$params = [
'service' => 'alipay.wap.trade.create.direct',
'format' => 'xml',
'v' => '2.0',
'partner' => yii::$app->params['alipay']['partner'], //合作者省份id
'req_id' => date('ymdhis'),
'sec_id' => yii::$app->params['alipay']['sign_type'],
'req_data' => $req_data,
];
$alipay = new alipay();
$alipay->key = yii::$app->params['alipay']['key'];
$alipay->alipay_config = $params;
$url = $alipay->buildpageurl();
$this->redirect($url);
3. 配置示例:
复制代码 代码如下:
//支付宝相关配置
'alipay' => [
'key' => 'xxxxx', //交易安全校验码,用于签名的32位密钥
'transport' => 'https', //消息验证地址使用访问方式
'seller_email' => 'xxxx', //卖家支付宝账号,即收款账户
'service' => 'create_direct_pay_by_user', //接口名称
'partner' => 'xxxx', //合作者省份id
'_input_charset' => 'utf-8', //参数编码字符集
'sign_type' => 'md5', //签名方式,不参加签名,目前只能是md5
//以下两个参数没用
'notify_url' => '', //服务器异步通知页面路径
'return_url' => '', //页面跳转通知页面路径
],
'alipay' => [
'key' => 'xxxxx', //交易安全校验码,用于签名的32位密钥
'transport' => 'https', //消息验证地址使用访问方式
'seller_email' => 'xxxx', //卖家支付宝账号,即收款账户
'service' => 'create_direct_pay_by_user', //接口名称
'partner' => 'xxxx', //合作者省份id
'_input_charset' => 'utf-8', //参数编码字符集
'sign_type' => 'md5', //签名方式,不参加签名,目前只能是md5
//以下两个参数没用
'notify_url' => '', //服务器异步通知页面路径
'return_url' => '', //页面跳转通知页面路径
],
希望本文所述对大家的php程序设计有所帮助。