1、安装easywechat
2、使用
$path = '/pages/index/index';
$config = [
'app_id' => 'wxb5axxxx',
'secret' => 'XXXX',
'response_type' => 'array',
'log' => [
'level' => 'debug',
'file' => __DIR__.'/wechat.log',
],
];
$app = Factory::miniProgram($config);
$response = $app->app_code->get($path);
if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
$qr_filename = $response->saveAs('wxmp/mp/', 'mp.png');
}