自定義菜單
自定義菜單是指為單個(gè)應(yīng)用設(shè)置自定義菜單功能,所以在使用時(shí)請(qǐng)注意調(diào)用正確的應(yīng)用實(shí)例。
<?php
$config = [
// 企業(yè)微信后臺(tái)的 企業(yè) ID
'corpId' => 'xxxxxxxxxxxxxxxxx',
// 企業(yè)微信后臺(tái)的 secret
'corpSecret' => 'xxxxxxxxxxxxxxxxx',
// ...
];
// 企業(yè)微信
$work = \EasySwoole\WeChat\Factory::work($config);
創(chuàng)建菜單
<?php
$menus = [
'button' => [
[
'name' => '首頁',
'type' => 'view',
'url' => 'http://www.fe88.cn'
],
[
'name' => '關(guān)于我們',
'type' => 'view',
'url' => 'http://www.fe88.cn/about'
],
// ...
],
];
$work->menu->create($menus);
獲取菜單
$work->menu->get();
刪除菜單
$work->menu->delete();