文档:微信开发
文档:微信开发
微信公众号开发
<a name="wechat"></a>
微信公众号
<a name="wechat-config"></a>
配置
'wechat' => [
'appid' => '',
'token' => '',
'aes_key' => '',
'secret' => '',
'redirect_uri' => '',
'platform' => [ // 第三方平台配置
'component_appid' => '',
'aes_key' => '',
'token' => '',
'component_appSecret' => ''
]
]
<a name="wechat-menu"></a>
消自定义菜单
获取菜单
设置菜单
(new Menu())->create(
MenuItem::menu(MenuItem::name('网址')->setUrl('http://zodream.cn'))
->setMenu(
MenuItem::menu(MenuItem::name('点击')->setKey(1))
->setMenu(MenuItem::name('点击')->setKey(1))
)
->setMenu(MenuItem::name('查看')->setMediaId('132123123'))
);
删除全部菜单
<a name="wechat-message"></a>
消息被动接收回复
$message = new Message();
return $message->on([EventEnum::ScanSubscribe, EventEnum::Subscribe],
function(Message $message, MessageResponse $response) {
$response->setText('谢谢关注!');
})->on(EventEnum::Message, function(Message $message, MessageResponse $response) {
$response->setText(sprintf('您的消息是: %s', $message->content));
})->on(EventEnum::UnSubscribe, function(Message $message, MessageResponse $response) {
$response->setText('取消关注');
})->on(EventEnum::Click, function(Message $message, MessageResponse $response) {
$response->setText(sprintf('您点击了 %s', $message->eventKey));
})->run()->sendContent();
<a name="platform"></a>
微信公众号第三方平台
<a name="platform-notify"></a>
事件推送
<a name="platform-manage"></a>
管理
<a name="platform-oauth"></a>