这几天升级扬帆cms,支持微信,用到了https://github.com/dodgepudding/wechat-php-sdk,
其中涉及到几个数组结构,备忘一下:
// 自定义菜单数组
// 菜单1及其子菜单
$menusArray [0] [‘name‘] = ‘菜单1‘;
$menusArray [0] [‘type‘] = ‘click‘;
$menusArray [0] [‘key‘] = ‘menu_1‘;
// 子菜单为消息类型
$menusArray [0] [‘sub_button‘] [0] [‘name‘] = ‘菜单1_1‘;
$menusArray [0] [‘sub_button‘] [0] [‘type‘] = ‘click‘;
$menusArray [0] [‘sub_button‘] [0] [‘key‘] = ‘menu_1_1‘;
// 子菜单为链接--打开百度
$menusArray [0] [‘sub_button‘] [1] [‘name‘] = ‘菜单1_2‘;
$menusArray [0] [‘sub_button‘] [1] [‘type‘] = ‘view‘;
$menusArray [0] [‘sub_button‘] [1] [‘key‘] = ‘menu_1_2‘;
$menusArray [0] [‘sub_button‘] [1] [‘url‘] = ‘http://www.czsfn.com/sw/‘;
// 菜单2
//$menusArray [1] [‘name‘] = ‘菜单2‘ . $this->unicode2utf8_2 ( ‘\ue159‘ );
$menusArray [1] [‘name‘] = ‘菜单2‘ ;
$menusArray [1] [‘type‘] = ‘click‘;
$menusArray [1] [‘key‘] = ‘menu_2‘;
// 菜单3--点击打开一个QQ网页
$menusArray [2] [‘name‘] = ‘菜单3‘;
$menusArray [2] [‘type‘] = ‘view‘;
$menusArray [2] [‘key‘] = ‘menu_3‘;
$menusArray [2] [‘url‘] = ‘http://www.czsfn.com/zw/‘;
$menusNavArray [‘button‘] = $menusArray;
//模版消息数组
$tmpdataArray[‘touser‘] = $touser;
$tmpdataArray[‘template_id‘] = ‘eWLeFyzFiTfox5rsQSRtHs1WgNh4SKyycBHWPJPlmjk‘;
$tmpdataArray[‘url‘] = ‘http://www.biaofan.cc‘;
$tmpdataArray[‘topcolor‘] = ‘#FF0000‘;
$tmpdataArray[‘data‘][‘first‘][‘value‘] = "您好,您已购买成功";
$tmpdataArray[‘data‘][‘first‘][‘color‘] = "#173177";
$tmpdataArray[‘data‘][‘orderProductName‘][‘value‘] = "微时代电影票";
$tmpdataArray[‘data‘][‘orderProductName‘][‘color‘] = "#173177";
$tmpdataArray[‘data‘][‘orderMoneySum‘][‘value‘] = "39.8元";
$tmpdataArray[‘data‘][‘orderMoneySum‘][‘color‘] = "#173177";
$tmpdataArray[‘data‘][‘Remark‘][‘value‘] = "欢迎再次购买标梵商城商品";
$tmpdataArray[‘data‘][‘Remark‘][‘color‘] = "#173177";
//高级群发数组
$msgdataArray[‘touser‘][] = $touser; //可以增加多个touser
$msgdataArray[‘touser‘][] = $touser;
$msgdataArray[‘msgtype‘]=‘text‘; //在下面5种类型中选择对应的参数内容 text | mpnews | voice | image | mpvideo => array( "media_id"=>"MediaId")
$msgdataArray[‘text‘][‘content‘]="亲,这是高级群发消息";
//高级群发art数组
$msgartdataArray[‘touser‘][] = $touser; //可以增加多个touser
$msgartdataArray[‘touser‘][] = $touser;
$msgartdataArray[‘msgtype‘]=‘mpnews‘; //在下面5种类型中选择对应的参数内容 text | mpnews | voice | image | mpvideo => array( "media_id"=>"MediaId")
$msgartdataArray[‘mpnews‘][‘media_id‘]="lUknUW7mP8x225hUhAeaACiBxyGQ3_IdrS68NcDKDL_O7nj6inhlvwLPngsqDmJV";
//预览高级群发数组
$premsgdataArray[‘touser‘] = $touser;
$premsgdataArray[‘msgtype‘]=‘text‘; //在下面5种类型中选择对应的参数内容 text | mpnews | voice | image | mpvideo => array( "media_id"=>"MediaId")
$premsgdataArray[‘text‘][‘content‘]="亲,这是预览高级群发消息";
//上传图文消息数组
$artdata[‘articles‘][0][‘thumb_media_id‘]="4UzeKkLrM_BEdCpw9nlKPI8aesWmxm1SbPRN6O3jj9S5HjVw_Tltz9rSCNcEw3T2";
$artdata[‘articles‘][0][‘author‘]="标梵互动";
$artdata[‘articles‘][0][‘title‘]="标梵互动测试文章";
$artdata[‘articles‘][0][‘content_source_url‘]="http://www.czsfn.com/fw/";
$artdata[‘articles‘][0][‘content‘]="<font color=red>标梵互动测试文章内容</font>";
$artdata[‘articles‘][0][‘digest‘]="图文消息的描述";
$artdata[‘articles‘][0][‘show_cover_pic‘]="1";
$artdata[‘articles‘][1][‘thumb_media_id‘]="4UzeKkLrM_BEdCpw9nlKPI8aesWmxm1SbPRN6O3jj9S5HjVw_Tltz9rSCNcEw3T2";
$artdata[‘articles‘][1][‘author‘]="标梵互动";
$artdata[‘articles‘][1][‘title‘]="标梵互动测试文章1";
$artdata[‘articles‘][1][‘content_source_url‘]="www.biaofan.com.cn";
$artdata[‘articles‘][1][‘content‘]="<font color=red>标梵互动测试文章内容1</font>";
$artdata[‘articles‘][1][‘digest‘]="图文消息的描述1";
$artdata[‘articles‘][1][‘show_cover_pic‘]="0";