微信企業號建立菜單php
<?php define('CorpID', "wx82e2c31215d9a5a7"); define('CorpSecret', ""); //當前管理組 設置->功能設置->權限管理->系統管理組->深圳管理(新建的管理組)->Secret define('AgentID', "24"); //當前應用ID require_once("../../class/wxqiye.class.php"); $weixin = new class_wxqiye(); $button = array(array('name' => "點擊跳轉", 'sub_button' => array( array('type' => "click", 'name' => bytes_to_emoji(0x1F3C3)."點擊推事件", 'key' => "COMPANY" ), array('type' => "view", 'name' => bytes_to_emoji(0x1F4C5)."跳轉URL", 'url' => "http://www.fangbei.org/" ), ) ), array('name' => "掃碼發圖", 'sub_button' => array( array('type' => "scancode_waitmsg", 'name' => "掃碼帶提示", 'key' => "rselfmenu_2_1" ), array('type' => "scancode_push", 'name' => "掃碼推事件", 'key' => "rselfmenu_2_2" ), array('type' => "pic_sysphoto", 'name' => "系統拍照發圖", 'key' => "rselfmenu_2_3" ), array('type' => "pic_photo_or_album", 'name' => "拍照或相冊發圖", 'key' => "rselfmenu_2_3" ), array('type' => "pic_weixin", 'name' => "微信相冊發圖", 'key' => "rselfmenu_2_5" ) ) ), array('type' => "location_select", 'name' => "發送位置", 'key' => "rselfmenu_3_0", ) ); function bytes_to_emoji($cp) { if ($cp > 0x10000){ # 4 bytes return chr(0xF0 | (($cp & 0x1C0000) >> 18)).chr(0x80 | (($cp & 0x3F000) >> 12)).chr(0x80 | (($cp & 0xFC0) >> 6)).chr(0x80 | ($cp & 0x3F)); }else if ($cp > 0x800){ # 3 bytes return chr(0xE0 | (($cp & 0xF000) >> 12)).chr(0x80 | (($cp & 0xFC0) >> 6)).chr(0x80 | ($cp & 0x3F)); }else if ($cp > 0x80){ # 2 bytes return chr(0xC0 | (($cp & 0x7C0) >> 6)).chr(0x80 | ($cp & 0x3F)); }else{ # 1 byte return chr($cp); } } $result = $weixin->create_menu($button); var_dump($result); ?>