本文整理汇总了PHP中Wechat::getRevData方法的典型用法代码示例。如果您正苦于以下问题:PHP Wechat::getRevData方法的具体用法?PHP Wechat::getRevData怎么用?PHP Wechat::getRevData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Wechat
的用法示例。
在下文中一共展示了Wechat::getRevData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Wechat
<?php
include_once "common.php";
$weObj = new Wechat($wechatoptions);
$weObj->valid();
//明文或兼容模式可以在接口验证通过后注释此句,但加密模式一定不能注释,否则会验证失败
$type = $weObj->getRev()->getRevType();
switch ($type) {
case Wechat::MSGTYPE_TEXT:
$revdata = $weObj->getRevData();
$super = in_array($revdata['FromUserName'], $testusers) ? 1 : 0;
//是否特殊用户
if ($super) {
if ("report" == $revdata['Content']) {
//$text = curl('http://119.29.78.76/gdmuwx/report.php');
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('wxtextmsg') . " WHERE status='0'");
$text = '';
while ($read = $_SGLOBAL['db']->fetch_array($query)) {
foreach ($read as $key => $value) {
$text .= $key . ' : ' . $value . "\n";
}
$text .= "\n";
}
if (empty($text)) {
$text = 'no new message';
} else {
$text = substr($text, 0, strlen($text) - 2 * strlen("\n"));
updatetable('wxtextmsg', array('status' => 1), array('status' => 0));
}
$weObj->text($text)->reply();
exit;
示例2: 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("-----------------------------------------");