<?php
namespace app\index\controller;
use EasyWeChat\Factory;
class Index
{
public function index()
{
$config = [
'app_id' => 'wx90636672********',
'secret' => '8c2391e3ccfabee663************',
'token' => '****',
// 指定 API 调用返回结果的类型:array(default)/collection/object/raw/自定义类名
'response_type' => 'array',
'log' => [
'level' => 'debug',
'file' => __DIR__.'/../../wechat.log',
],
];
$app = Factory::officialAccount($config);
$response = $app->server->serve();
$response->send(); // Laravel 里请使用:return $response;
}
}
个人博客 www.hzfblog.com