微信 公众号 开发 建立 自定义 菜单 php 栏目 PHP 繁體版
原文   原文链接
<?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);
}
?>
相关文章
相关标签/搜索
每日一句
    每一个你不满意的现在,都有一个你没有努力的曾经。
本站公众号
   欢迎关注本站公众号,获取更多信息