当前位置: 首页>>代码示例>>PHP>>正文


PHP Wechat::getRev方法代码示例

本文整理汇总了PHP中Wechat::getRev方法的典型用法代码示例。如果您正苦于以下问题:PHP Wechat::getRev方法的具体用法?PHP Wechat::getRev怎么用?PHP Wechat::getRev使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Wechat的用法示例。


在下文中一共展示了Wechat::getRev方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct(Wechat $wechat)
 {
     $this->content = $wechat->getRev()->getRevContent();
     $this->sender = $wechat->getRev()->getRevFrom();
     $this->create_time = $wechat->getRev()->getRevCtime();
     $this->msg_id = $wechat->getRev()->getRevID();
     $this->models = new TextModel();
     $this->models->actionIndex($this->content, $this->sender, $this->msg_id);
 }
开发者ID:emonmit,项目名称:shikun.wang-wechat-gsjl,代码行数:9,代码来源:TextController.php

示例2: index

 public function index()
 {
     import('Vendor.Wechat.Wechat');
     $option = array('token' => 'weixin', 'appid' => 'wx444c22311a33b40d', 'secret' => 'f39ae15e9d86c293edbff26a9c47af6e');
     $wechatObj = new \Wechat($option);
     $wechatObj->valid();
     //解析来向XML
     $msg = $wechatObj->getRev();
     $message['fromUsername'] = $msg->getRevFrom();
     $message['toUsername'] = $msg->getRevTo();
     $message['type'] = $msg->getRevType();
     $message['createtime'] = $msg->getRevCtime();
     $message['keyword'] = $msg->getRevContent();
     $message['event'] = $msg->getRevEvent();
     //保存新用户相关信息
     $status = D('Member');
     $status->InsertNewer($message['fromUsername']);
     //主要部分,暂时仅使用TEXT,EVENT两种
     switch ($message['type']) {
         case $wechatObj::MSGTYPE_TEXT:
             $text = A('Text');
             $ret = $text->textSkip($message);
             if ('text' == $ret['type']) {
                 $wechatObj->text($ret['content'])->reply();
             } else {
                 if ('news' == $ret['type']) {
                     $wechatObj->news($ret['content'])->reply();
                 }
             }
             break;
         case $wechatObj::MSGTYPE_EVENT:
             $event = A('Event');
             $ret = $event->eventSkip($message);
             if ('text' == $ret['type']) {
                 $wechatObj->text($ret['content'])->reply();
             } else {
                 if ('news' == $ret['type']) {
                     $wechatObj->news($ret['content'])->reply();
                 }
             }
             break;
         default:
             $wechatObj->text('更多功能正在研发中,敬请期待')->reply();
     }
     //获取菜单
     $menu = $wechatObj->getMenu();
     //创建菜单
     $newmenu = array('小瓜神力' => array(array('type' => 'click', 'name' => '新生专题', 'key' => 'V1001_01_01'), array('type' => 'click', 'name' => '校车时刻', 'key' => 'V1001_01_02'), array('type' => 'click', 'name' => '交通导航', 'key' => 'V1001_01_03'), array('type' => 'click', 'name' => '考试成绩', 'key' => 'V1001_01_04'), array('type' => 'click', 'name' => '图书信息', 'key' => 'V1001_01_05')), '军训专题' => array(array('type' => 'click', 'name' => '通知公告', 'key' => 'V1001_02_01'), array('type' => 'click', 'name' => '军训快报', 'key' => 'V1001_02_02'), array('type' => 'click', 'name' => '军营风采', 'key' => 'V1001_02_03'), array('type' => 'view', 'name' => '军歌嘹亮', 'url' => 'http://mp.weixin.qq.com/s?__biz=MjM5OTIxMTM2Mg==&mid=209183345&idx=1&sn=96c4cf9ad618e5e051167456210d9fe8&scene=5&srcid=OJ8qMfaW9nS5T0jFFjQj#rd'), array('type' => 'click', 'name' => '微军训', 'key' => 'V1001_02_05')), '小瓜威武' => array(array('type' => 'click', 'name' => '小瓜在线', 'key' => 'V1001_03_01'), array('type' => 'click', 'name' => '跑操查询', 'key' => 'V1001_03_02'), array('type' => 'view', 'name' => '瓜棚论坛', 'url' => 'http://npuxiaogua.mgschool.cn/wx/apps/liuyan/'), array('type' => 'view', 'name' => '失物招领', 'url' => 'http://npuxiaogua.mgschool.cn/wx/npuxg_blog/wxq/index.php'), array('type' => 'click', 'name' => '表白墙', 'key' => 'V1001_03_05')));
     $result = $wechatObj->createMenu($newmenu);
 }
开发者ID:partholon,项目名称:xiaogua,代码行数:50,代码来源:IndexController.class.php

示例3: endpoint

 public function endpoint()
 {
     import('ORG.Util.wechat');
     $weObj = new Wechat();
     $type = $weObj->getRev()->getRevType();
     switch ($type) {
         case Wechat::MSGTYPE_TEXT:
             $weObj->text($this->search_orgs($weObj->getRevContent()))->reply();
             exit;
             break;
         case Wechat::MSGTYPE_EVENT:
             break;
         case Wechat::MSGTYPE_IMAGE:
             break;
         case Wechat::MSGTYPE_LOCATION:
             $weObj->text($this->search_events($weObj->getRevGeo()))->reply();
             exit;
             break;
         default:
             $weObj->text("help info")->reply();
     }
 }
开发者ID:baixinxing,项目名称:ngo20map6,代码行数:22,代码来源:WeChatAction.class.php

示例4: array

<?php

include "wechat.class.php";
$options = array('token' => 'tokenaccesskey', 'encodingaeskey' => '5lLtUYtyRLDM5zCuG43TxcHpKSK5ydENbozq78XhIOi');
$weObj = new Wechat($options);
$weObj->valid();
//明文或兼容模式可以在接口验证通过后注释此句,但加密模式一定不能注释,否则会验证失败
// 获取菜单操作:
$menu = $weObj->getMenu();
// 设置菜单
$newmenu = array("button" => array(array('name' => '医院信息', 'sub_button' => array(array("type" => "view", 'name' => '医院主页', "url" => "http://www.blkqyy.com/"), array("type" => "click", 'name' => '门诊时间', "key" => "time"), array("type" => "view", 'name' => '医院地址', "url" => "http://blkqyy.com/wap.php/index-map.html"), array("type" => "view", 'name' => '专业团队', "url" => "http://mp.weixin.qq.com/s?__biz=MzA3NDEyMTcxMw==&mid=202512101&idx=1&sn=478061005d164632ccbb3a79b36d5e85#rd"))), array('name' => '就医导航', 'sub_button' => array(array('type' => 'click', 'name' => '常见咨询', 'key' => 'quest'), array('type' => 'click', 'name' => '我要留言', 'key' => 'liuyan'), array('type' => 'view', 'name' => '来院导航', 'url' => 'http://map.wap.soso.com/x/index.jsp?welcomeChange=1&sid=AfYicfAV0b1upF4O4-Lnzj_z&welcomeClose=1&hideAdvert=hide&type=infowindow&open=1&address=中国浙江省宁波市北仑区星中路7号&name=宁波市北仑口腔&referer=weixinmp_profile&g_ut=3&Y=29.910579&X=121.84133&Z=16&from=singlemessage&'), array('type' => 'view', 'name' => '在线咨询', 'url' => 'http://dx.zoosnet.net/lrserver/LR/Chatpre.aspx?id=LZS32497012'))), array('name' => '爱牙知识', 'sub_button' => array(array('type' => 'view', 'name' => '成人宣教视频', 'url' => 'http://mp.weixin.qq.com/s?__biz=MzA3NDEyMTcxMw==&mid=200521821&idx=1&sn=1272b4da141a38ab66bfab0d1e64b4b4#rd'), array('type' => 'view', 'name' => '儿童宣教视频', 'url' => 'http://mp.weixin.qq.com/s?__biz=MzA3NDEyMTcxMw==&mid=200276316&idx=1&sn=8695db64330bd7129786e2b4f769c32c#rd'), array('type' => 'view', 'name' => '爱牙知识讲堂', 'url' => 'http://mp.weixin.qq.com/s?__biz=MzA3NDEyMTcxMw==&mid=203297479&idx=1&sn=dd41afb15383148c9b353e61e210d394#rd'), array('type' => 'view', 'name' => '最新资讯', 'url' => 'http://mp.weixin.qq.com/s?__biz=MzA3NDEyMTcxMw==&mid=203379412&idx=1&sn=39fc677860d67d5fea82ff924cde88a4#rd')))));
$result = $weObj->createMenu($newmenu);
$type = $weObj->getRev()->getRevType();
$revfrom = $weObj->getRev()->getRevFrom();
$getrevto = $weObj->getRev()->getRevTo();
switch ($type) {
    case Wechat::MSGTYPE_TEXT:
        $msg = $weObj->getRev()->getRevContent();
        switch ($msg) {
            case 'openid':
                //get openid
                $openid = $weObj->getRev()->getRevFrom();
                $weObj->text('openid:' . $openid)->reply();
                break;
            case '预约查询':
                $newsData = array($item = array('Title' => '预约查询', 'Description' => '点击查看', 'Url' => 'www.blkqyy.com/admin.php/message/add_yuyue.html?weixin_id=' . $topmsg['fakeid']));
                $weObj->news($newsData)->reply();
                break;
            default:
                $weObj->text("您的消息我们已经收到,感谢您的支持!")->reply();
                break;
开发者ID:dlpc,项目名称:weixin_php_sdk,代码行数:31,代码来源:demo.php

示例5: openlog

    //$result = file_put_contents('wechat.log.'.date('Y-m-d'), $text."\n", FILE_APPEND);
    //if (!$result) {
    openlog("wechat", LOG_PID | LOG_PERROR, LOG_LOCAL0);
    syslog(LOG_DEBUG, $text);
    closelog();
    //}
}
$options = array('token' => 'N6cq3R', 'encodingaeskey' => 'nil3OzTxXoPHx4mvx0GLbyECkPYrfyiB9ca4Iz61ny3', 'appid' => 'wx926454a4965d2b7c', 'appsecret' => 'PkG1V74sWm6V2mNN3F2NOHKQT696g1wrmJZhB7WT-8xcLmt-3rez3FfuH3SzCf', 'agentid' => '3', 'debug' => true, 'logcallback' => '_log');
$weObj = new Wechat($options);
_log("GET参数为:\n" . var_export($_GET, true));
$valid = $weObj->valid();
if (!$valid) {
    _log("验证失败");
    exit($valid);
}
$recv = $weObj->getRev();
$type = $recv->getRevType();
switch ($type) {
    case Wechat::MSGTYPE_TEXT:
        $weObj->text("I got your message, here is <a href=\"http://www.gds-services.com\">gds</a>")->reply();
        exit;
        break;
    case Wechat::MSGTYPE_IMAGE:
        $weObj->text("I got your image")->reply();
        break;
    case Wechat::MSGTYPE_EVENT:
        $event = $recv->getRevEvent();
        $message = array("0" => array("Title" => "GDS携云灾备方案参加第十届灾备论坛 助力大数据价值挖掘", "Description" => "GDS携云灾备方案参加第十届灾备论坛 助力大数据价值挖掘", "Url" => "http://www.gds-services.com/new_1787.html", "PicUrl" => "http://www.gds-services.com/upload/articles/1434592478.jpg"), "1" => array("Title" => "Bash漏洞爆发,GDS迅速应对", "Description" => "Bash漏洞爆发,GDS迅速应对", "Url" => "http://www.gds-services.com/new_1757.html", "PicUrl" => "http://www.gds-services.com/images/imgc-1.png"));
        $weObj->news($message)->reply();
        break;
    default:
开发者ID:adexbn,项目名称:gds_wechat,代码行数:31,代码来源:index.php

示例6: logdebug

<?php

/**
 * 微信公共接口测试
 * 
 */
include "../wechat.class.php";
function logdebug($text)
{
    file_put_contents('../data/log.txt', $text . "\n", FILE_APPEND);
}
$options = array('token' => 'tokenaccesskey', 'debug' => true, 'logcallback' => 'logdebug');
$weObj = new Wechat($options);
$weObj->valid();
$type = $weObj->getRev()->getRevType();
switch ($type) {
    case Wechat::MSGTYPE_TEXT:
        $weObj->text("hello, I'm wechat")->reply();
        exit;
        break;
    case Wechat::MSGTYPE_EVENT:
        break;
    case Wechat::MSGTYPE_IMAGE:
        break;
    default:
        $weObj->text("help info")->reply();
}
开发者ID:pinghu1,项目名称:wechat-php-sdk,代码行数:27,代码来源:test1.php

示例7: msgSend

<?php

include 'config.php';
include 'wechat-php-sdk/wechat.class.php';
include 'public/fun.php';
include 'public/invitees.php';
$options = array('token' => $siteData['wechatToken'], 'appid' => $siteData['wechatAppID'], 'appsecret' => $siteData['wechatAppSecret']);
$weObj = new Wechat($options);
$weObj->valid();
$weObj->getRev();
/**
 * 自动回复
 */
function msgSend($key)
{
    global $WEDDING_INVITEES;
    global $weObj;
    $key = strtolower($key);
    switch ($key) {
        case 'welcome':
            // 回复文字信息
            $weObj->text("欢迎关注")->reply();
            /* 回复图文信息
            			$weObj->news(
            				array(
            					 '0' => array(
            						'Title' => '标题',
            						'PicUrl' => '图片地址',
            						'Url' => '网址'
            					)
            				)
开发者ID:juanjuanwang,项目名称:wedding,代码行数:31,代码来源:wechat.php

示例8: _log1

function _log1($text)
{
    //$result = file_put_contents('wechat.log.'.date('Y-m-d'), $text."\n", FILE_APPEND);
    //if (!$result) {
    openlog("wechat", LOG_PID | LOG_PERROR, LOG_LOCAL0);
    syslog(LOG_DEBUG, $text);
    closelog();
    //}
}
$options = ['token' => 'nizhidaoma', 'encodingaeskey' => 'xc8rRK4iOQjTJK9hOYhRrC9sPBJvF5Jhjq203iMC7vF', 'appid' => 'wxe85832e232e73f41', 'appsecret' => '4c8f1aa381675dd2569fc9482052afdc', 'debug' => true, 'logcallback' => '_log1'];
$csc_host_base = 'https://wechat.gds-services.com';
$csc_url_base = 'https://wechat.gds-services.com';
$default_reply = '欢迎使用万国数据微信客服。' . '如需帮助,欢迎随时致电:<a href="tel:4000724366">4000-724-366</a>。';
$weObj = new Wechat($options);
$weObj->valid();
$type = $weObj->getRev()->getRevType();
$openid = $weObj->getRev()->getRevFrom();
_log1(json_encode(['type' => $type, 'openid' => $openid]));
switch ($type) {
    case Wechat::MSGTYPE_TEXT:
        $text = $weObj->getRev()->getRevContent();
        $weObj->transfer_customer_service()->reply();
        break;
    case Wechat::MSGTYPE_EVENT:
        $event = $weObj->getRev()->getRevEvent();
        _log1(json_encode(['event' => $event]));
        switch ($event['event']) {
            case Wechat::EVENT_SUBSCRIBE:
                $bind_url = $csc_url_base . '/dynamic/user_isbind_csc.php?openid=' . $openid . '&bcb=user_bind_check_csc&rand=' . rand();
                $weObj->text("您好!欢迎来到万国数据客户服务中心。\n\n" . "若您是万国数据的授权用户,您可以在绑定账号后体验我们为您带来的更多专属服务喔~\n" . "<a href=\"" . $bind_url . "\">点击这里绑定账号</a>\n\n" . "如有疑问,欢迎您直接留言。")->reply();
                $user = $weObj->getUserInfo($openid);
开发者ID:adexbn,项目名称:gds_wechat,代码行数:31,代码来源:api_csc.php

示例9: __construct

 public function __construct(Wechat $wechat)
 {
     $this->sender = $wechat->getRev()->getRevFrom();
     $this->event = $wechat->getRev()->getRevEvent();
     $this->models = new EventModel();
 }
开发者ID:emonmit,项目名称:shikun.wang-wechat-gsjl,代码行数:6,代码来源:EventController.php

示例10: array

<?php

include_once '../../config.php';
$site = get_site(__DIR__);
include_once CONFIG_PATH . '/' . $site . PHP_EXT;
include_once WEIXIN_PATH . '/class/wechat.class.php';
if (WECHAT_ENCODING_ENABLE) {
    $options = array('token' => WECHAT_TOKEN, 'encodingaeskey' => WECHAT_ENCODING_AES_KEY, 'appid' => WECHAT_APP_ID, 'appsecret' => WECHAT_APP_SECRET);
} else {
    $options = array('token' => WECHAT_TOKEN);
}
$weObj = new Wechat($options);
$weObj->valid();
$type = $weObj->getRev()->getRevType();
switch ($type) {
    case Wechat::MSGTYPE_TEXT:
        $content = $weObj->getRev()->getRevContent();
        if ($content == WEIXIN_AUTH_MESSAGE) {
            $fromUserName = $weObj->getRev()->getRevFrom();
            $url = SERVER_HOST . "/guest/sdk/weixin/redirct.php?fromUserName=" . $fromUserName;
            $text = "<a href='{$url}'>点击上网</a>";
            $weObj->text($text)->reply();
        }
        break;
    case Wechat::MSGTYPE_EVENT:
        $revEvent = $weObj->getRev()->getRevEvent();
        $event = $revEvent['event'];
        if ($event == 'subscribe') {
            //关注微信操作
            $weObj->text(WEIXIN_WELCOME_MESSAGE)->reply();
        } else {
开发者ID:blackzw,项目名称:auth,代码行数:31,代码来源:weixin.php

示例11: array

<?php

header("Content-type: text/html; charset=utf-8");
//微信服务端引用
require './wechat/wechat.class.php';
$options = array('token' => 'scubike', 'appid' => 'YOUR_APPID', 'appsecret' => 'YOUR_APPSECRET');
$systemError = "系统错误,请稍后再试";
$apiUrl = "http://1.scubiketest.sinaapp.com";
$apiSuffix = "php";
$w = new Wechat($options);
$w->valid();
$type = $w->getRev()->getRevType();
switch ($type) {
    case Wechat::MSGTYPE_TEXT:
        $w->text("感谢您的留言,稍后回复您!")->reply();
        break;
    case Wechat::MSGTYPE_EVENT:
        $result = $w->getRevEvent();
        switch ($result['event']) {
            case 'subscribe':
                if ($w->getRevSceneId()) {
                    //0.将该扫描事件写入数据库,扫描时间,用户id,
                    $postScanurl = $apiUrl . "/postScan." . $apiSuffix;
                    //写入扫描时间的api @post
                    $param = array('wechatId' => $w->getRevFrom(), 'createAt' => $w->getRevCtime(), 'stationId' => $w->getRevSceneId(), 'status' => 0);
                    http_post($postScanurl, $param);
                    //1.检查数据库是否有该用户
                    $getUserinfoUrl = $apiUrl . "/getUserinfo." . $apiSuffix . "?wechatId=" . $w->getRevFrom();
                    $userinfo = json_decode(http_get($getUserinfoUrl));
                    //2.如果有,查询该用户是否有借车行为
                    if ($userinfo->status == "0") {
开发者ID:MiaoMiaosha,项目名称:bike,代码行数:31,代码来源:wechat.php

示例12: add

 public function add()
 {
     include "./wechat-php-sdk/wechat.class.php";
     $options = array('token' => 'tokenaccesskey');
     $weObj = new Wechat($options);
     $weObj->valid();
     $type = $weObj->getRev()->getRevType();
     switch ($type) {
         case Wechat::MSGTYPE_TEXT:
             $weObj->text("hello, I'm wechat")->reply();
             exit;
             break;
         case Wechat::MSGTYPE_EVENT:
             break;
         case Wechat::MSGTYPE_IMAGE:
             break;
         default:
             $weObj->text("help info")->reply();
     }
 }
开发者ID:huanlanxingduan,项目名称:wechat-activity,代码行数:20,代码来源:ContentAction.class.php

示例13: safe_replace

<?php

@define("WE_ROOT", dirname(__FILE__) . "/");
require_once WE_ROOT . "wechat.class.php";
require_once WE_ROOT . "tuling.func.php";
require_once WE_ROOT . "idioms.func.php";
require_once WE_ROOT . "UnderCover.func.php";
$options = array('token' => 'huangang');
$weObj = new Wechat($options);
$weObj->valid();
$type = $weObj->getRev()->getRevType();
$username = $weObj->getRev()->getRevFrom();
$content = $weObj->getRev()->getRevContent();
$content = safe_replace($content);
$mysql = new SaeMysql();
$sql = "select * from wx_users where openid = '{$username}' ";
$data = $mysql->getLine($sql);
if ($data) {
    $lock = $data['lock'];
} else {
    $sql = "insert into wx_users(openid) values('{$username}')";
    $mysql->runSql($sql);
    if ($mysql->errno() != 0) {
        die("Error:" . $mysql->errmsg());
    }
    $lock = "unlock";
}
$mysql->closeDb();
function safe_replace($string)
{
    $string = str_replace('%20', '', $string);
开发者ID:funny-guess,项目名称:wechat-server-php,代码行数:31,代码来源:test.php

示例14: logg

<?php

include "../qywechat.class.php";
function logg($text)
{
    file_put_contents('./log.txt', $text . "\r\n\r\n", FILE_APPEND);
}
$options = array('token' => '9xxxxxxxxxxxx', 'encodingaeskey' => 'd4oxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'appid' => 'wxa0xxxxxxxxxx', 'debug' => true, 'logcallback' => 'logg');
logg("GET参数为:\n" . var_export($_GET, true));
$weObj = new Wechat($options);
$ret = $weObj->valid();
if (!$ret) {
    logg("验证失败!");
    var_dump($ret);
    exit;
}
$f = $weObj->getRev()->getRevFrom();
$t = $weObj->getRevType();
$d = $weObj->getRevData();
$weObj->text("你好!来自星星的:" . $f . "\n你发送的" . $t . "类型信息:\n原始信息如下:\n" . var_export($d, true))->reply();
logg("-----------------------------------------");
开发者ID:congcongbebe,项目名称:wechat-php-sdk,代码行数:21,代码来源:qydemo.php

示例15: array

<?php

include "wechat.class.php";
$options = array();
$weObj = new Wechat($options);
//$weObj->valid();
$type = $weObj->getRev()->getRevType();
$userId = "无所谓的疯狂";
switch ($type) {
    case Wechat::MSGTYPE_TEXT:
        $result = 'hello,' . $weObj->getRev()->getRevFrom() . ", " . $weObj->getRev()->getRevContent();
        $weObj->text($result)->reply();
        exit;
        break;
    case Wechat::MSGTYPE_EVENT:
        $arrayEvent = $weObj->getRev()->getRevEvent();
        $eventResult = $arrayEvent['event'] . " : " . $arrayEvent['key'];
        $weObj->text($eventResult)->reply();
        break;
    case Wechat::MSGTYPE_IMAGE:
        $imageurl = $weObj->getRev()->getRevPic();
        $weObj->text('hello, ' . $imageurl)->reply();
        break;
    default:
        $weObj->showNum();
        $result2 = 'hello, ' . $weObj->getRev()->getRevFrom() . $weObj->getRev()->getRevContent();
        $weObj->text($result2)->reply();
}
开发者ID:keqi24,项目名称:WechatTest,代码行数:28,代码来源:demo.php


注:本文中的Wechat::getRev方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。