當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Wechat::text方法代碼示例

本文整理匯總了PHP中Wechat::text方法的典型用法代碼示例。如果您正苦於以下問題:PHP Wechat::text方法的具體用法?PHP Wechat::text怎麽用?PHP Wechat::text使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Wechat的用法示例。


在下文中一共展示了Wechat::text方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: kefu

 public function kefu()
 {
     import('Wechat', APP_PATH . 'Common/Wechat', '.class.php');
     $config = M("Wxconfig")->where(array("id" => "1"))->find();
     $options = array('token' => $config["token"], 'encodingaeskey' => $config["encodingaeskey"], 'appid' => $config["appid"], 'appsecret' => $config["appsecret"], 'partnerid' => $config["partnerid"], 'partnerkey' => $config["partnerkey"], 'paysignkey' => $config["paysignkey"]);
     $weObj = new Wechat($options);
     $weObj->text("kefu")->reply();
     /*$image = realpath(dirname(__FILE__).'/../../../../').'/kefu.jpg';
     		$data['media'] = "@$image";
     		$res = $weObj->uploadMedia($data, 'image');
     		$weObj->getRev ()->image ( $res['media_id'] )->reply ();*/
     exit;
 }
開發者ID:zhezhisama,項目名稱:zz,代碼行數:13,代碼來源:ApiAction0.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";
include "./controller/textController/TextController.php";
include "./controller/eventController/EventController.php";
include "./model/TextModel.php";
include "./model/EventModel.php";
include "./config/params.php";
$options = array('token' => '', 'encodingaeskey' => '', 'appid' => '', 'appsecret' => '');
$weObj = new Wechat($options);
$weObj->valid();
$type = $weObj->getRev()->getRevType();
switch ($type) {
    case Wechat::MSGTYPE_TEXT:
        $textObj = new TextController($weObj);
        $reply = $textObj->replyIndex();
        $weObj->text($reply)->reply();
        break;
    case Wechat::MSGTYPE_EVENT:
        $eventObj = new EventController($weObj);
        $reply = $eventObj->replyIndex();
        //$weObj->text($reply)->reply();
        $weObj->news($reply)->reply();
        break;
    case Wechat::MSGTYPE_IMAGE:
        break;
    default:
        $weObj->text("help info")->reply();
}
開發者ID:emonmit,項目名稱:shikun.wang-wechat-gsjl,代碼行數:29,代碼來源:gsjlx.php

示例5: switch

$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);
                _log_focus($openid, 'focus', $user);
                break;
            case Wechat::EVENT_UNSUBSCRIBE:
                _log_focus($openid, 'unfocus');
            case Wechat::EVENT_MENU_CLICK:
                $key = $event['key'];
                switch ($key) {
                    case 'wechat_csc':
                        $kf_list = $weObj->getCustomServiceOnlineKFlist();
                        $kf_count = count($kf_list);
                        if ($kf_count <= 0) {
                            $weObj->text('我們的客服都在緊張地忙碌中,暫時無法及時響應,請稍作等待。' . '您也可以致電萬國數據400熱線:<a href="tel:4000724366">4000-724-366</a>,' . '我們會有電話客服專員專門響應您的請求。')->reply();
                        } else {
                            $weObj->text('目前共有 ' . $kf_count . ' 位客服在線。' . '我們會以最快的速度給予響應')->reply();
開發者ID:adexbn,項目名稱:gds_wechat,代碼行數:31,代碼來源:api_csc.php

示例6: Wechat

    //}
}
$options = ['token' => 'nizhidaoma', 'encodingaeskey' => 'xc8rRK4iOQjTJK9hOYhRrC9sPBJvF5Jhjq203iMC7vF', 'appid' => 'wxe85832e232e73f41', 'appsecret' => '4c8f1aa381675dd2569fc9482052afdc', 'debug' => true, 'logcallback' => '_log1'];
$pe_host_base = 'https://wechat.gds-services.com';
$pe_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:
        $bind_url = $pe_url_base . '/dynamic/user_isbind_pe.php?openid=' . $openid . '&bcb=user_bind_check_pe&rand=' . rand();
        $text = $weObj->getRev()->getRevContent();
        $weObj->text("感謝您關注GDS運維管理公眾號。\n\n" . "此公眾號用於GDS內部係統信息查詢和獲取推送消息。\n\n" . "如果您還未綁定GDS統一認證平台賬號,請<a href=\"" . $bind_url . "\">點擊這裏綁定賬號</a>\n\n" . '如有疑問或需要幫助,請聯係係統工具部【謝雲昭】。')->reply();
        break;
    case Wechat::MSGTYPE_EVENT:
        $event = $weObj->getRev()->getRevEvent();
        switch ($event['event']) {
            case Wechat::EVENT_SUBSCRIBE:
                $bind_url = $pe_url_base . '/dynamic/user_isbind_pe.php?openid=' . $openid . '&bcb=user_bind_check_pe&rand=' . rand();
                $weObj->text("感謝您關注GDS運維管理公眾號。\n\n" . "此公眾號用於GDS內部係統信息查詢和獲取推送消息," . "<a href=\"" . $bind_url . "\">點擊這裏綁定賬號</a>\n\n" . '如有疑問或需要幫助,請聯係係統工具部【謝雲昭】。')->reply();
                $user = $weObj->getUserInfo($openid);
                _log_focus($openid, 'focus', $user);
                break;
            case Wechat::EVENT_UNSUBSCRIBE:
                _log_focus($openid, 'unfocus');
            case Wechat::EVENT_MENU_CLICK:
                $key = $event['key'];
                switch ($key) {
開發者ID:adexbn,項目名稱:gds_wechat,代碼行數:31,代碼來源:api_pe.php

示例7: Wechat

$wechatOptions = (require './configure.php');
$wechatObj = new Wechat($wechatOptions);
$wechatObj->valid();
//可以在認證後注釋掉(隻是這樣可能不安全)
$wechatObj->positiveInit();
//主動響應組件初始化
$wechatObj->setAutoSendOpenidSwitch(TRUE);
//設置自動附帶發送Openid
$wechatObj->setPassiveAscSwitch(TRUE, TRUE);
//設置打開被動關聯組件,並獲取用戶詳細信息
$wechatObj->getRev();
$revtype = $wechatObj->getRev()->getRevType();
switch ($revtype) {
    case Wechat::MSGTYPE_TEXT:
        if (strstr($wechatObj->getRevContent(), "dddddddCSdddddsddddddd")) {
            $wechatObj->text("是英明的小弟。")->reply();
        } elseif (strstr($wechatObj->getRevContent(), "ligboy")) {
            $wechatObj->text("是你英明的老大啊。\n\n你快點叫老大吧。")->reply();
        } elseif (preg_match('/^[\\s]*?幫助[\\s]*?$/', $wechatObj->getRevContent()) || preg_match('/^[\\s]*?help[\\s]*?$/', $wechatObj->getRevContent())) {
            $wechatObj->text("福大人幫助-有效的指令\n我的圖書館\n綁定圖書館\n取消綁定圖書館\n借閱信息\n")->reply();
        } else {
            $wechatObj->text("福大人幫助-有效的指令\n我的圖書館\n綁定圖書館  卡號  密碼\n取消綁定圖書館\n借閱信息  卡號  密碼")->reply();
        }
        break;
    case Wechat::MSGTYPE_EVENT:
        $revEvent = array();
        $revEvent = $wechatObj->getRevEvent();
        switch ($revEvent['event']) {
            case "subscribe":
                $wechatObj->text("歡迎您關注福大人,我們會用心為您服務。\n目前您可以使用的功能有:\n我的圖書館:發送: ”我的圖書館“指令查看\n\n如果您閑來無聊,可以試試和福大人小機器人聊天哦。\n    福大人工作室" . "")->reply();
                break;
開發者ID:laahii,項目名稱:Wechat-php,代碼行數:31,代碼來源:wechat.php

示例8: array

// 獲取菜單操作:
$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;
        }
        exit;
        break;
        // 接收語音消息
    // 接收語音消息
    case Wechat::MSGTYPE_VOICE:
        $voice = $weObj->getRevVoice();
開發者ID:dlpc,項目名稱:weixin_php_sdk,代碼行數:31,代碼來源:demo.php

示例9: 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

示例10: Wechat

$weObj = new Wechat($options);
$weObj->valid();
//明文或兼容模式可以在接口驗證通過後注釋此句,但加密模式一定不能注釋,否則會驗證失敗
$openid = $weObj->getRev()->getRevFrom();
$token = $weObj->checkAuth();
$info = $weObj->getUserInfo($openid);
$type = $weObj->getRev()->getRevType();
switch ($type) {
    case Wechat::MSGTYPE_TEXT:
        $content = $weObj->getRev()->getRevContent();
        if (substr($content, 0, 6) == '姓名') {
            $name = substr($content, 6);
            $res = array("0" => array('Title' => $name . ', 你的生辰八字', 'Description' => 'Vonvon作為國際化的SNS社交媒體,從2015年1月起,在全世界已經擁有1億以上的 用戶。現在已在韓國,中國,台灣,泰國,越南,印尼,美國,巴西,西班牙等國家 開放。將來會拓展到更多的國家,並且會創作更多有趣的主題測試。', 'PicUrl' => 'http://cdn-cn-static-dr.vonvon.net/images/cn/recruit_main.jpg', 'Url' => 'http://cn.vonvon.net/'));
            $weObj->news($res)->reply();
        } else {
            $weObj->text("Your nickname is " . $info['nickname'] . "\nYour sex is " . $info['sex'] . "\nYour city is " . $info['city'] . "\nYour province is " . $info['province'] . "\n Your country is " . $info['country'] . "\nYour headimgurl is " . $info['headimgurl'] . "\nYour subscribe_time is " . date("Y-m-d H:i:s", $info['subscribe_time']) . "\nNow is " . date("Y-m-d H:i:s", time()))->reply();
            exit;
        }
        break;
    case Wechat::MSGTYPE_EVENT:
        $event = $weObj->getRev()->getRevEvent();
        switch ($event['event']) {
            case 'subscribe':
                $subscribe = array("0" => array('Title' => $info['nickname'] . ', welcome to VonVon!', 'Description' => 'Vonvon作為國際化的SNS社交媒體,從2015年1月起,在全世界已經擁有1億以上的 用戶。現在已在韓國,中國,台灣,泰國,越南,印尼,美國,巴西,西班牙等國家 開放。將來會拓展到更多的國家,並且會創作更多有趣的主題測試。', 'PicUrl' => 'http://cdn-cn-static-dr.vonvon.net/images/cn/recruit_main.jpg', 'Url' => 'http://cn.vonvon.net/'), "1" => array('Title' => '盜墓筆記測試——你是南派還是北派', 'Description' => '你看過盜墓筆記嗎?你知道盜墓人士中分南派和北派嗎?來測一下你是屬於什麽派的吧?', 'PicUrl' => 'http://cdn-cn.vonvon.net/vonvon-cn-real/editor/1436839209469-SArBr8o9DJoXcpLx.jpg', 'Url' => 'http://cn.vonvon.net/quiz/424'));
                $weObj->news($subscribe)->reply();
                break;
            case 'CLICK':
                switch ($event['key']) {
                    case 'god':
                        $god = array("0" => array('Title' => '神製作我的時候【第二彈夏日特製版】', 'Description' => '神製作我的時候【第二彈夏日特製版】', 'PicUrl' => 'http://cdn-cn.vonvon.net/vonvon-cn-real/editor/1435891488403-VNAPCjjJcyU3cqxw.jpg', 'Url' => 'http://cn.vonvon.net/quiz/380'), "1" => array('Title' => '神製作我的時候', 'Description' => '神製作我的時候', 'PicUrl' => 'http://cdn-cn.vonvon.net/vonvon-cn-real/editor/mig/2015-06-11/a63b5eb123914f85a5e15ede5561c80b', 'Url' => 'http://cn.vonvon.net/quiz/341'));
                        $weObj->news($god)->reply();
開發者ID:shengnwen,項目名稱:vonvonWX,代碼行數:31,代碼來源:index.php

示例11: array

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 = strtolower($revEvent['event']);
        if ($event == 'subscribe') {
            //關注微信操作
            $weObj->text(WEIXIN_WELCOME_MESSAGE)->reply();
        } else {
            if ($event == 'unsubscribe') {
                //取消關注微信操作
                $fromUserName = $weObj->getRev()->getRevFrom();
                //取消上網權限
                $sql = "select * from " . WEIXIN_TABLE . "\n                    WHERE `fromUserName` = '{$fromUserName}'";
                $res = $mysql::query($sql, 'all');
開發者ID:blackzw,項目名稱:auth,代碼行數:31,代碼來源:weixin.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: upuserlock

    $string = str_replace('*', '', $string);
    $string = str_replace('"', '&quot;', $string);
    $string = str_replace("'", '', $string);
    $string = str_replace('"', '', $string);
    $string = str_replace(';', '', $string);
    $string = str_replace('<', '&lt;', $string);
    $string = str_replace('>', '&gt;', $string);
    $string = str_replace("{", '', $string);
    $string = str_replace('}', '', $string);
    $string = str_replace(' ', '', $string);
    return $string;
}
switch ($type) {
    /*關注事件回複*/
    case Wechat::MSGTYPE_EVENT:
        $weObj->text("hello, I'm wechat\n平台現有功能:\n智能聊天,成語接龍,誰是臥底遊戲")->reply();
        exit;
        break;
        /*文本事件回複*/
    /*文本事件回複*/
    case Wechat::MSGTYPE_TEXT:
        if (substr($content, 0, 12) == "成語接龍") {
            $lock = "idioms";
            upuserlock($lock, $username);
            $content = substr($content, 12);
        }
        if (substr($content, 0, 12) == "誰是臥底") {
            $lock = "under_cover";
            upuserlock($lock, $username);
            $content = substr($content, 12);
        }
開發者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::text方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。