微信付款到零錢

2021-10-18 14:40:01 字數 2864 閱讀 3763

<?php

namespace

globalunit\utils

;use

qys\log\log

;class

wxcash

/** * [arraytoxml 將陣列轉換成xml格式(簡單方法):]

* @param [type] $data [陣列]

* @return [type] [array 轉 xml]

*/function

arraytoxml

($data

)$str.=

'';return

$str;}

/** * [createnoncestr 生成隨機字串]

* @param integer $length [長度]

* @return [type] [字母大小寫加數字]

*/function

createnoncestr

($length=32

)return

$str;}

/** * [curl_post_ssl 傳送curl_post資料]

* @param [type] $url [傳送位址]

* @param [type] $xmldata [傳送檔案格式]

* @param [type] $second [設定執行最長秒數]

* @param [type] $aheader [設定頭部]

* @return [type] [description]

*/function

curl_post_ssl

($url

,$xmldata

,$second=30

,$aheader

=array()

)curl_setopt

($ch

,curlopt_post,1

);//post提交方式

curl_setopt

($ch

,curlopt_postfields

,$xmldata);

//全部資料使用http協議中的"post"操作來傳送

$data

=curl_exec

($ch);

//執行回話

var_dump

("data>>>>>"

.$data);

if($data

)else

}/**

* [sendmoney 企業付款到零錢]

* @param [type] $amount [傳送的金額(分)目前傳送金額不能少於1元]

* @param [type] $re_openid [傳送人的 openid]

* @param string $desc [企業付款描述資訊 (必填)]

* @param string $check_name [收款使用者姓名 (選填)]

* @return [type] [description]

*/function

sendmoney

($amount

,$re_openid

,$desc

='為使用者支付'

,$check_name=''

,$client_ip

="116.3.204.19"

)$str.=

'key='

.$secrect_key

;$data

['sign']=

md5(

$str);

//生成簽名演算法

$xml

=$this

->

arraytoxml

($data);

$url

='';//呼叫介面

$res

=$this

->

curl_post_ssl

($url

,$xml);

$return

=$this

->

xmltoarray

($res);

print_r

($return);

//返回來的結果是xml,最後轉換成陣列

/* array(9)

string(18) "wx57676786465544b2a5"

["mchid"]=>

string(10) "143345612"

["nonce_str"]=>

string(32) "iw6tthdoysmafs81qcnqxojwumn8l8my"

["result_code"]=>

string(7) "success"

["partner_trade_no"]=>

string(18) "201807011410504098"

["payment_no"]=>

string(28) "1000018301201807019357038738"

["payment_time"]=>

string(19) "2018-07-01 14:56:35"}*/

$responseobj

=******xml_load_string

($res

,'******xmlelement'

,libxml_nocdata);

echo

$res

=$responseobj

->

return_code

;//success 如果返回來success,則發生成功,處理自己的邏輯

return

$return;}

}

微信企業付款到零錢

企業提現 public function actionindex else 隨機字串 param int length return string private function getnoncestr length 32 return str 簽名 param data return strin...

微信支付之企業付款到零錢

public function pay to change orderid,openid,amount 簽名步驟一 按字典序排序引數 ksort parameters string this formatbizqueryparamap parameters,false 簽名步驟二 在string後加...

微信提現企業付款到零錢

class index public function tixian openid,money mch id mch id 商戶號 key key api金鑰 openid openid 授權使用者openid arr array arr mchid mch id arr nonce str md5...