ThinkPHP 沒SDK的微信支付

2021-10-05 23:23:02 字數 1292 閱讀 9782

下面是沒有用官方的sdk

//生成預支付訂單

function wechatpay($openid,$amount, $out_trade_no, $body = '測試')

else

}

/**

*/public function notify()

else

}catch (\exception $exception)

}else

}

class wxpay extends controller

$xml .= "";

return $xml;

}//xml格式資料解析函式

function xmldataparse($data)

//隨機字串

function createnoncestr($length = 32)

return $str;}/*

* 格式化引數格式化成url引數 生成簽名sign

*///簽名步驟一:按字典序排序引數

ksort($parameters);

$string = $this->formatbizqueryparamap($parameters, false);

//echo '【string1】'.$string.'

'; //簽名步驟二:在string後加入key

}//echo "【string2】".$string."

"; //簽名步驟三:md5加密

$string = md5($string);

//echo "【string3】 ".$string."

"; //簽名步驟四:所有字元轉為大寫

$result_ = strtoupper($string);

//echo "【result】 ".$result_."

"; return $result_;

}//按字典序排序引數

function formatbizqueryparamap($paramap, $urlencode)

$buff .= $k . "=" . $v . "&";

}if (strlen($buff) > 0)

return $reqpar;

}

// http請求

function sendprepaycurl($xml, $second = 30)

else

}

微信群發sdk

2018.8.21 xucheng class wechatsendnews public function index data else 獲取token data 訊息json串 public function updateimage path,type else else 上傳 public ...

微信sdk的使用

apis裡面是js介面列表。back是介面用wx.介面名。對應apis裡面的介面。使用wxapi的時候都呼叫一次 var init function apis,back 10 then db wx.ready export default showmenuitems title,imgurl,spi...

微信支付SDK的使用

答案是因為使用支付sdk時,遇到了很多弱智的坑,希望後來人不要和我一樣sb就好。iwxapi api weixinsdk.getinstance getwxapi payreq request new payreq request.packagevalue sign wxpay 這是個固定字串,就是...