<?php include "TokenUtil.php"; //TokenUtil::build_access_token(); $access_token = TokenUtil::read_token(); getSucaiList($access_token); function getSucaiList($token){ $url = ‘https://api.weixin.qq.com/cgi-bin/menu/create?access_token=‘.$token; $Data = ‘{ "button": [ { "type": "click", "name": "哈哈哈", "key": "V1001_TODAY_MUSIC" }, { "name": "影视", "sub_button": [ { "type": "view", "name": "搜索", "url": "http://www.soso.com/" }, { "type": "click", "name": "赞一下我们", "key": "V1001_GOOD" } ] } ] }‘; //初始化 $ch = curl_init(); //设置参数 curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,true); curl_setopt ( $ch, CURLOPT_POST, true ); curl_setopt ( $ch, CURLOPT_POSTFIELDS, $Data); curl_setopt ( $ch, CURLOPT_HEADER, false ); //采集 $output = curl_exec($ch); //关闭 echo $output; curl_close($ch); } ?>