本文整理匯總了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("-----------------------------------------");