$code = $_GET['code']; \LaneWeChat\Core\WeChatOAuth::getAccessTokenAndOpenId($code); //上传多媒体 \LaneWeChat\Core\Media::upload($filename, $type); //下载多媒体 \LaneWeChat\Core\Media::download($mediaId); /** * 自定义菜单 */ //设置菜单 $menuList = array(array('id' => '1', 'pid' => '', 'name' => '常规', 'type' => '', 'code' => 'key_1'), array('id' => '2', 'pid' => '1', 'name' => '点击', 'type' => 'click', 'code' => 'key_2'), array('id' => '3', 'pid' => '1', 'name' => '浏览', 'type' => 'view', 'code' => 'http://www.lanecn.com'), array('id' => '4', 'pid' => '', 'name' => '扫码', 'type' => '', 'code' => 'key_4'), array('id' => '5', 'pid' => '4', 'name' => '扫码带提示', 'type' => 'scancode_waitmsg', 'code' => 'key_5'), array('id' => '6', 'pid' => '4', 'name' => '扫码推事件', 'type' => 'scancode_push', 'code' => 'key_6'), array('id' => '7', 'pid' => '', 'name' => '发图', 'type' => '', 'code' => 'key_7'), array('id' => '8', 'pid' => '7', 'name' => '系统拍照发图', 'type' => 'pic_sysphoto', 'code' => 'key_8'), array('id' => '9', 'pid' => '7', 'name' => '拍照或者相册发图', 'type' => 'pic_photo_or_album', 'code' => 'key_9'), array('id' => '10', 'pid' => '7', 'name' => '微信相册发图', 'type' => 'pic_weixin', 'code' => 'key_10'), array('id' => '11', 'pid' => '1', 'name' => '发送位置', 'type' => 'location_select', 'code' => 'key_11')); \LaneWeChat\Core\Menu::setMenu($menuList); //获取菜单 \LaneWeChat\Core\Menu::getMenu(); //删除菜单 \LaneWeChat\Core\Menu::delMenu(); /** * 应用一:给粉丝群发发送消息 */ //群发消息 //获取粉丝列表 $fansList = \LaneWeChat\Core\UserManage::getFansList(); //上传图片 $menuId = \LaneWeChat\Core\Media::upload('/var/www/baidu_jgylogo3.jpg', 'image'); if (empty($menuId['media_id'])) { die('error'); } //上传图文消息 $list = array(); $list[] = array('thumb_media_id' => $menuId['media_id'], 'author' => '作者', 'title' => '标题', 'content_source_url' => 'www.lanecn.com', 'digest' => '摘要', 'show_cover_pic' => '1'); $list[] = array('thumb_media_id' => $menuId['media_id'], 'author' => '作者', 'title' => '标题', 'content_source_url' => 'www.lanecn.com', 'digest' => '摘要', 'show_cover_pic' => '0');
/** * 清除微信菜单 */ public function caear_menu() { if (IS_AJAX) { $rel = Menu::delMenu(); if ($rel['errcode'] == 0) { $this->ajaxSuccess(''); } } $this->ajaxError('删除失败'); }