當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。