<?php
$token =
"https://api.weixin.qq.com/cgi-bin/menu/create?access_token=根据(https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET)生成自己的token";
$str = file_get_contents($token);
$access_token = json_decode($str,
true);
$token1 = $access_token['access_token'];
$url =
"https://api.weixin.qq.com/cgi-bin/menu/create?access_token=$token1";
$post_data = ' {
"button":[
{
"name":
"涂涂旅行",
"sub_button":[
{
"type":
"view",
"name":
"旅游景点介绍",
"url":
"http://www.sove.xin"
},
{
"type":
"view",
"name":
"周末旅行",
"url":
"http://www.sove.xin"
},
{
"type":
"click",
"name":
"优惠活动",
"key":
"V1001_GOOD"
}]
},
{
"type":
"view",
"name":
"在线订票",
"url":
"http://www.sove.xin"
},
{
"type":
"view",
"name":
"会员中心",
"url":
"http://www.sove.xin"
}
]
}';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,
1);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,
false);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,
2);
curl_setopt($ch, CURLOPT_POST,
1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
$output = curl_exec($ch);
curl_close($ch);
print_r($output);
?>