Exemple #1
0
<?php

include './../XYWeChat.php';
$arr = array(array('id' => 1, 'pid' => '', 'name' => '用户中心', 'type' => 'click', 'code' => 'test'), array('id' => 2, 'pid' => '', 'name' => '活动中心', 'type' => 'click', 'code' => ''), array('id' => 3, 'pid' => '', 'name' => '自助服务', 'type' => 'about', 'code' => ''), array('id' => 4, 'pid' => '1', 'name' => '注册邦定', 'type' => 'click', 'code' => 'tuwen'), array('id' => 5, 'pid' => '1', 'name' => '实名认证', 'type' => 'click', 'code' => 'duotuwen'), array('id' => 6, 'pid' => '1', 'name' => '修改信息', 'type' => 'click', 'code' => 'getimg'), array('id' => 7, 'pid' => '1', 'name' => '自驾游', 'type' => 'click', 'code' => 'getimg'), array('id' => 8, 'pid' => '1', 'name' => '免费领取', 'type' => 'click', 'code' => 'getimg'), array('id' => 9, 'pid' => '2', 'name' => '热门活动', 'type' => 'view', 'code' => 'http://www.xyser.com/XYWeChat/demo/oauth.php'), array('id' => 10, 'pid' => '2', 'name' => '扫一扫', 'type' => 'scancode_push', 'code' => 'saosao'), array('id' => 11, 'pid' => '2', 'name' => '景区门票', 'type' => 'scancode_waitmsg', 'code' => 'scancode_waitmsg'), array('id' => 12, 'pid' => '2', 'name' => '保险业务', 'type' => 'pic_sysphoto', 'code' => 'pic_sysphoto'), array('id' => 13, 'pid' => '3', 'name' => '汽车保养', 'type' => 'location_select', 'code' => 'location_select'));
if ($_GET['action'] == 'set') {
    $echo = \XYWeChat\Menu::setMenu($arr);
    print_r($echo);
}
echo '<br>' . time();
Exemple #2
0
$code = $_GET['code'];
\XYWeChat\WeChatOAuth::getAccessTokenAndOpenId($code);
//上传多媒体
\XYWeChat\Media::upload($filename, $type);
//下载多媒体
\XYWeChat\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'));
\XYWeChat\Menu::setMenu($menuList);
//获取菜单
\XYWeChat\Menu::getMenu();
//删除菜单
\XYWeChat\Menu::delMenu();
/**
 * 应用一:给粉丝群发发送消息
 */
//群发消息
//获取粉丝列表
$fansList = \XYWeChat\UserManage::getFansList();
//上传图片
$menuId = \XYWeChat\Media::upload('/var/www/baidu_jgylogo3.jpg', 'image');
if (empty($menuId['media_id'])) {
    exit('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');