本文整理汇总了PHP中wechatCallbackapiTest::responseMsg方法的典型用法代码示例。如果您正苦于以下问题:PHP wechatCallbackapiTest::responseMsg方法的具体用法?PHP wechatCallbackapiTest::responseMsg怎么用?PHP wechatCallbackapiTest::responseMsg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wechatCallbackapiTest
的用法示例。
在下文中一共展示了wechatCallbackapiTest::responseMsg方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: valid
<?php
/**
* wechat php test
*/
include 'weixinlib/textmsg.php';
include 'weixinlib/secretmsg.php';
$wechatObj = new wechatCallbackapiTest();
$wechatObj->responseMsg('<xml><ToUserName><![CDATA[gh_3b9f2b7cbeb1]]></ToUserName>
<FromUserName><![CDATA[onJi-jkBg94_yLkoQLmlVFDTPqfk]]></FromUserName>
<CreateTime>1364050029</CreateTime>
<MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA[kk]]></Content>
<MsgId>5858550264762860409</MsgId>
</xml>');
class wechatCallbackapiTest
{
public function valid()
{
$echoStr = $_GET['echostr'];
//valid signature , option
if ($this->checkSignature()) {
echo $echoStr;
$this->responseMsg();
exit;
}
}
public function responseMsg($postStr)
{
//get post data, May be due to the different environments
// $postStr = $GLOBALS['HTTP_RAW_POST_DATA'];
//extract post data
示例2: responseMsg
<?php
//功能是提供大转盘的兑换,目前是加积分2,且只有一个奖项
$wechatObj = new wechatCallbackapiTest();
$wechatObj->responseMsg();
class wechatCallbackapiTest
{
public function responseMsg()
{
$keyword = trim($_GET['quan']);
$fromUsername = $_GET['name'];
require_once 'conn.php';
preg_match_all("/[A-Za-z0-9]/", $keyword, $match01);
$select = $match01[0];
foreach ($select as $val) {
$abc .= $val;
}
$item = substr($abc, 4, 2);
//创建时间记录
$t = time();
$datestamp = date("Y-m-d H:i:s", $t);
//更新历史列表
$checklist = mysql_fetch_array(mysql_query("select * from shop_history where secret = '{$abc}'"));
if (!empty($checklist) && $checklist['used'] == "NO") {
mysql_query("UPDATE shop_history SET used = 'YES', usedtime='{$datestamp}' WHERE secret = '{$abc}'");
//获取积分
$result_jifen = mysql_fetch_array(mysql_query("select * from jifen where user like '%{$fromUsername}%'"));
if ($item == "04") {
$score_changed = $result_jifen['score'] + 4;
//增加积分量
} elseif ($item == "01") {
示例3: index
public function index()
{
/*{{{*/
$wechatObj = new wechatCallbackapiTest();
if (isset($_GET['echostr'])) {
$wechatObj->valid();
} else {
$wechatObj->responseMsg();
}
}