本文整理汇总了PHP中Wechat::getRevFrom方法的典型用法代码示例。如果您正苦于以下问题:PHP Wechat::getRevFrom方法的具体用法?PHP Wechat::getRevFrom怎么用?PHP Wechat::getRevFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wechat
的用法示例。
在下文中一共展示了Wechat::getRevFrom方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
switch ($revEvent['event']) {
case "subscribe":
$wechatObj->text("欢迎您关注福大人,我们会用心为您服务。\n目前您可以使用的功能有:\n我的图书馆:发送: ”我的图书馆“指令查看\n\n如果您闲来无聊,可以试试和福大人小机器人聊天哦。\n 福大人工作室" . "")->reply();
break;
case "unsubscribe":
break;
}
break;
case Wechat::MSGTYPE_IMAGE:
$newsData = array(0 => array('Title' => '欢迎您关注福大人', 'Description' => "欢迎您关注福大人,我们会用心为您服务。\n\n 福大人工作室", 'PicUrl' => 'http://com/weixin//static/images/fzu.gif', 'Url' => 'http://r.com/weixin//info.html'));
$wechatObj->news($newsData)->reply();
break;
case Wechat::MSGTYPE_LOCATION:
$revGeo = $wechatObj->getRevGeo();
if ($revGeo) {
$wechatObj->text("您的位置信息是:X=" . $revGeo['x'] . ",Y=" . $revGeo['y'] . "\n" . $revGeo['label'])->reply();
}
break;
case Wechat::MSGTYPE_VOICE:
//多媒体消息关联获取id,并下载文件到服务器本地示例
$oneMessage = $wechatObj->getOneMessage($wechatObj->getRevCtime(), $wechatObj->getRevType(), $wechatObj->getRevFrom());
$mediaFile = array();
if ($oneMessage) {
$mediaFile = $wechatObj->getDownloadFile($oneMessage["id"]);
}
// $wechatObj->text(serialize($mediaFile))->reply();
$wechatObj->text($oneMessage ? "消息id:{$oneMessage['id']}\n类型:{$oneMessage['type']}\nLO时间戳:" . $wechatObj->getRevCtime() . "\nMP时间戳:{$oneMessage['dateTime']}\n文件路径:{$mediaFile['filename']}\n文件大小:{$mediaFile['filesize']}\n文件类型:{$mediaFile['filetype']}" : "获取失败\nLO时间戳:" . $wechatObj->getRevCtime() . print_r($oneMessage, TRUE))->reply();
break;
default:
$wechatObj->text("help info")->reply();
}
示例2: Wechat
$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") {
//@get
$userLendUrl = $apiUrl . "/userLend." . $apiSuffix . "?userId=" . $userinfo->info->userId . "&lendStatus=0";
$userLend = json_decode(http_get($userLendUrl));
//3.如果2的结果是有,提示:XX请在3分钟内点击下方还车按钮进行还车
if ($userLend->status == "0") {
$lendtips = "尊敬的用户" . $userinfo->info->wechatName . ",您已借车,请在3分钟内点击下方的还车按钮进行还车" . $userlend->status;
$w->text($lendtips)->reply();
} else {
if ($userLend->status == "102") {
示例3: array
require_once 'db.php';
require_once 'wechat.class.php';
require_once 'function.php';
include 'emoji.php';
$options = array('token' => WX_TOKEN, 'appid' => WX_APPID, 'encodingaeskey' => WX_KEY, 'appsecret' => WX_SECRET);
$weObj = new Wechat($options);
$weObj->valid();
$redirectURI = urlencode("http://" . WX_URL . "/main.php");
$authURI = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" . WX_APPID . "&redirect_uri=" . $redirectURI . "&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect";
$type = $weObj->getRev()->getRevType();
switch ($type) {
case Wechat::MSGTYPE_IMAGE:
$pic = $weObj->getRevPic();
$db = new DB();
$db->connect();
$userInfo = $db->getInfo($weObj->getRevFrom());
if ($userInfo['state'] != 0) {
$weObj->text("你已经通过认证!")->reply();
} else {
$db->postImg($weObj->getRevFrom(), $pic['mediaid']);
if ($userInfo['pic']) {
$weObj->text("成功修改证件照片!")->reply();
} else {
$weObj->text("成功录入证件照片!\n再次提交即可修改")->reply();
}
}
$db->disconnect();
break;
case Wechat::MSGTYPE_TEXT:
$weObj->text("你好,欢迎来到imall 公益电商平台 和" . WX_TITLE . " 校园公共自行车服务!\n\n<a href='http://www.imall365.org'>点此开始imall公益电商之旅!</a>\n<a href='" . $authURI . "'>点此开始你的" . WX_TITLE . "!</a>")->reply();
break;
示例4: Wechat
* @version 1.0
*/
include "wechat.class.php";
$options = array
(
'token'=>'weego',
'debug'=>true,
'logcallback'=>'logdebug'
);
$weObj = new Wechat($options);
// 验证
$weObj->valid();
// 获取内容
$weObj->getRev();
// 获取用户的OpenID
$fromUsername = $weObj->getRevFrom();
// 获取接受信息的类型
$type = $weObj->getRev()->getRevType();
//**********关注操作则写入数据库**********/
if($weObj->getRevSubscribe())
{
// 获取用户OPENID并写入数据库
$mysql = new SaeMysql();
$sql = "INSERT INTO `users` (`wxid`) VALUES ('" . $fromUsername . "');";
$mysql->runSql($sql);
$mysql->closeDb();
// 获得信息的类型
$news = array
(
array