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