PHP code example of jiujiude / wechat-xiaowei
1. Go to this page and download the library: Download jiujiude/wechat-xiaowei library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jiujiude / wechat-xiaowei example snippets
e wei\Wechat;
$config = [
'appid' => '',
'secret' => '',
'mch_id' => '', //商户号
'serial_no' => '', //商户证书序列号
'aes_key' => '',
'diy_key' => '', //自定义key
];
$wechat = new Wechat($config);
try {
$wechat->downloadCertificates(); //下载证书
echo "成功";
} catch (WxException $e) {
echo $e->getMessage();
} catch (\Exception $e) {
echo $e->getMessage();
}