示例#1
0
<?php

/*
 * @copyright   Leyun internet Technology(Shanghai)Co.,Ltd
 * @license     http://www.dzzoffice.com/licenses/license.txt
 * @package     DzzOffice
 * @link        http://www.dzzoffice.com
 * @author      zyx(zyx@dzz.cc)
 */
$weObj = new qyWechat(array('token' => getglobal('setting/token_0'), 'appid' => getglobal('setting/CorpID'), 'appsecret' => getglobal('setting/CorpSecret'), 'agentid' => 0, 'encodingaeskey' => getglobal('setting/encodingaeskey_0'), 'debug' => true));
$weObj->valid();
//注意, 企业号与普通公众号不同,必须打开验证,不要注释掉
$type = $weObj->getRev()->getRevType();
switch ($type) {
    case qyWechat::MSGTYPE_TEXT:
        //文本消息
        /*$weObj->text($weObj->getRev()->getRevContent())->reply();*/
        break;
    case qyWechat::MSGTYPE_IMAGE:
        //图片消息
        /*$imageinfo=$weObj->getRev()->getRevPic();
        		$weObj->image($imageinfo['mediaid'])->reply();*/
        break;
    case qyWechat::MSGTYPE_VOICE:
        //语音消息
        /*$imageinfo=$weObj->getRev()->getRevPic();
        		$weObj->image($imageinfo['mediaid'])->reply();*/
        break;
    case qyWechat::MSGTYPE_VIDEO:
        //视频消息
        /*$voice=$weObj->getRev()->getRevVoice();
示例#2
0
<?php

/*
 * @copyright   Leyun internet Technology(Shanghai)Co.,Ltd
 * @license     http://www.dzzoffice.com/licenses/license.txt
 * @package     DzzOffice
 * @link        http://www.dzzoffice.com
 * @author      zyx(zyx@dzz.cc)
 */
$setting = unserialize($_G['setting']['feed_wxsetting']);
$weObj = new qyWechat(array('token' => $setting['token'], 'appid' => getglobal('setting/CorpID'), 'appsecret' => getglobal('setting/CorpSecret'), 'agentid' => $setting['agentid'], 'encodingaeskey' => $setting['encodingaeskey']));
$weObj->valid();
//注意, 企业号与普通公众号不同,必须打开验证,不要注释掉
$type = $weObj->getRev()->getRevType();
switch ($type) {
    case qyWechat::MSGTYPE_TEXT:
        //文本消息
        // $weObj->text($weObj->getRev()->getRevContent())->reply();
        break;
    case qyWechat::MSGTYPE_IMAGE:
        //图片消息
        /*$imageinfo=$weObj->getRev()->getRevPic();
        		$weObj->image($imageinfo['mediaid'])->reply();*/
        break;
    case qyWechat::MSGTYPE_VOICE:
        //语音消息
        /*$imageinfo=$weObj->getRev()->getRevPic();
        		$weObj->image($imageinfo['mediaid'])->reply();*/
        break;
    case qyWechat::MSGTYPE_VIDEO:
        //视频消息