function create_menu($token, $menu) { $url = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token={$token}"; $menu = array(array('button' => array('type' => 'click', 'name' => 'aa', 'key' => 'V1001_TODAY_MUSIC'), array(array("name" => "bb", "sub_button" => array(array("type" => "view", "name" => "vv", "url" => "http://wq.duguying.net/"), array("type" => "view", "name" => "百度", "url" => "http://www.soso.com/")))))); $data = json_encode($menu, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); exe_url($url, $data); }
function get_userinfo($code) { $arr = $this->get_access_token($code); $openid = $arr['openid']; $token = $this->get_token(); $url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token={$token}&openid={$openid}&lang=zh_CN"; return exe_url($url); }