Repository navigation
Expand file tree
/
Copy pathmenu.php
More file actions
122 lines (108 loc) · 2.61 KB
/
Copy pathmenu.php
File metadata and controls
122 lines (108 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
include "Http.class.php";
include "access_token.php";
include "Message.php";
$postStr = file_get_contents("php://input");
$data = array();
$data['button'] = array(
array(
'name' => '领克特',
'sub_button' => array(
//click
array(
'type' => 'click',
'name' => '最新优惠券',
'key' => 'coupon'
),
//view tencent://message/?uin=$qqnum&Site=在线咨询&Menu=yes
array(
'type' => 'view',
'name' => '微信2.0测试',
'url' => 'http://weixin.linktech.cn'
),
// scancode_push
array(
'type' => 'scancode_push',
'name' => '扫一扫',
'key' => 'saoma'
),
array(
'type' => 'view',
'name' => '微信首页',
'url' => 'http://weixin.linktech.cn/index.php'
)
)
),
array(
'name' => '☎联系我们',
'sub_button' => array(
// scancode_waitmsg
// array(
// 'type' => 'scancode_waitmsg',
// 'name' => '扫码带提示',
// 'key' => 'saomadaitishi'
// ),
// pic_sysphoto
array(
'type' => 'click',
'name' => '☕广告主合作',
'key' => 'merchant'
),
array(
'type' => 'pic_sysphoto',
'name' => '系统拍照发图',
'key' => 'photo'
),
array(
'type' => 'view',
'name' => '专属QQ客服',
'url' => 'http://wpa.qq.com/msgrd?v=3&uin=54619564&site=qq&menu=yes'
),
// pic_photo_or_album
array(
'type' => 'view',
'name' => '意向合作',
'url' => ''
),
//
)
),
array(
'name' => '购物吧',
'sub_button' => array(
// pic_weixin
array(
'type' => 'pic_weixin',
'name' => '相册发图',
'key' => 'wxxcft'
),
// location_select
array(
'type' => 'location_select',
'name' => '发送位置',
'key' => 'fsdw'
),
array(
'type' => 'view',
'name' => '我的购物吧',
'url' => 'http://xiaozhaofu.gw8888.com'
)
)
)
);
function decodeUnicode($str)
{
return preg_replace_callback('/\\\\u([0-9a-f]{4})/i',
create_function(
'$matches',
'return mb_convert_encoding(pack("H*", $matches[1]), "UTF-8", "UCS-2BE");'
// 'return iconv( "UCS-2BE","UTF-8",pack("H*", $matches[1]));'
),
$str);
}
$str = json_encode($data);
$strZ = decodeUnicode($str);
//自定义菜单接口 http请求方式:POST(请使用https协议) "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN"
$url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=".get_token();
$res = Http::post($url, $strZ);
var_dump($res);