PHP code example of topphp / topphp-wechat
1. Go to this page and download the library: Download topphp/topphp-wechat 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/ */
topphp / topphp-wechat example snippets
$config = [
'app_id' => 'wx3cf0f39249eb0exx',
'secret' => 'f1c242f4f28f735d4687abb469072axx',
];
$app = Factory::officialAccount($config);
$wechat = $this->app->get(WeChat::class);
$config = $this->app->config->get('wechat');
$app = $wechat::officialAccount($config);
# 也可以这样用
$app = WeChat::officialAccount($config);
# 但是要注意,这样是多例模式