自定义菜单
自定义菜单是指为单个应用设置自定义菜单功能,所以在使用时请注意调用正确的应用实例。
php
$config = [
'corp_id' => 'xxxxxxxxxxxxxxxxx',
'secret' => 'xxxxxxxxxx', // 应用的 secret
//...
];
$app = Factory::work($config);
1
2
3
4
5
6
2
3
4
5
6
创建菜单
php
$menus = [
'button' => [
[
'name' => '首页',
'type' => 'view',
'url' => 'https://easywechat.com'
],
[
'name' => '关于我们',
'type' => 'view',
'url' => 'https://easywechat.com/about'
],
//...
],
];
$app->menu->create($menus);
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
获取菜单
php
$app->menu->get();
1
删除菜单
php
$app->menu->delete();
1