成人精品一区二区三区中文字幕-成人精品一区二区三区-成人精品一级毛片-成人精品亚洲-日本在线视频一区二区-日本在线视频免费

導航首頁 ? 技術教程 ? PHP微信刮刮卡 附微信接口
全站頭部文字 我要出現在這里
PHP微信刮刮卡 附微信接口 735 2024-01-29   

無論大轉盤也好,或者是刮刮卡都是抽獎都可以利用同樣的方法來計算中獎的概率和控制獎池的數量,本文為大家分享了PHP微信刮刮卡實例代碼,PHP微信刮刮卡+接口,可直接調用,自帶微信接口,供大家學習。

效果圖:

查看圖片

prize.php

<?php
$rand = rand(1,100);
if($rand<10){
 $prize = '蘋果1個';
}else if($rand<30){
 $prize = '蘋果2個';
}else if($rand<60){
 $prize = '蘋果3個';
}else{
 $prize = '謝謝參與';
}

?>

<!DOCTYPE html>
<html>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
 <meta name="apple-mobile-web-app-capable" content="yes">
 <meta name="apple-mobile-web-app-status-bar-style" content="black">
 <meta name="format-detection" content="telephone=no">
 <title>刮刮卡</title>
 <link  rel="stylesheet" type="text/css">
 </head>
 
 </head>
 <body data-role="page" class="activity-scratch-card-winning">
 <script src="http://www.gimoo.net/t/1811/index/jquery.js" type="text/javascript"></script>
 <script src="http://www.gimoo.net/t/1811/index/wScratchPad.js" type="text/javascript"></script>
 <div class="main">
 <div class="cover">
 <img src="http://www.gimoo.net/t/1811/index/activity-scratch-card-bannerbg.png"> 
 <div id="prize"><?php echo $prize;?></div>
  <div id="scratchpad"></div>  
 </div>
 
 <div class="boxcontent boxwhite">
 <div class="box">
 <div class="title-brown">
 <span>
 獎項設置:
 </span>
 </div>
 <div class="Detail">
 <p>
 一等獎: iphone 5S 獎品數量:60
 </p>
 <p>
 二等獎: ipad mini2 獎品數量:100
 </p>
 <p>
 三等獎: 金士頓16G手機卡 獎品數量:2000
 </p>
 </div>
 </div>
 </div>
 
 <div class="boxcontent boxwhite">
 <div class="box">
 <div class="title-brown">
 活動說明:
 </div>
 <div class="Detail">
 <p class="red">
 中獎用戶請準確將收貨地址發送給我,我們將以貨到付款的方式郵寄給你!
 </p>
 <p>
 親,祝您好運哦!<a >再來一次</a>
 </p>
 </div>
 </div>
 </div>
 </div>
 <div style="clear:both;">
 </div>
 </div>
 
 <script type="text/javascript">
 window.sncode = "null";
 $(function() {
 $("#scratchpad").wScratchPad({
 width: 150,
 height: 40,
 color: "#a9a9a7",
 
 });
 });
 </script>
 
 </body>

</html>

sxxybbs_wx.php

<?php
/**
 * wechat php test
 */

//define your token
define("TOKEN", "wwwsxxybbscom");
$wechatObj = new wechatCallbackapiTest();
//$wechatObj->valid();
$wechatObj->responseMsg();
class wechatCallbackapiTest
{
 public function valid()
 {
 $echoStr = $_GET["echostr"];

 //valid signature , option
 if($this->checkSignature()){
  echo $echoStr;
  exit;
 }
 }

 public function responseMsg()
 {
 //get post data, May be due to the different environments
 $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];

 //extract post data
 if (!empty($postStr)){
  
  $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
 $fromUsername = $postObj->FromUserName;
  $toUsername = $postObj->ToUserName;
 $time = time();
 
 if($postObj->Content == '1'){
 $textTpl = "<xml>
 <ToUserName><![CDATA[%s]]></ToUserName>
 <FromUserName><![CDATA[%s]]></FromUserName>
 <CreateTime>%s</CreateTime>
 <MsgType><![CDATA[%s]]></MsgType>
 <Content><![CDATA[%s]]></Content>
 <FuncFlag>0</FuncFlag>
 </xml>"; 
 $msgType = 'text';
 $contentStr = "你輸入了:1";
 $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
   echo $resultStr;
 
 }else if($postObj->Content == '抽獎'){
 $newsTpl ="<xml>
  <ToUserName><![CDATA[%s]]></ToUserName>
  <FromUserName><![CDATA[%s]]></FromUserName>
  <CreateTime>%s</CreateTime>
  <MsgType><![CDATA[news]]></MsgType>
  <ArticleCount>1</ArticleCount>
  <Articles>
  <item>
  <Title><![CDATA[刮刮樂翻天]]></Title> 
  <Description><![CDATA[我就要去刮刮樂,抽獎去!]]></Description>
  <PicUrl><![CDATA[http://special.sxcq.cn/cj/weixin/ggk/ggk.jpg]]></PicUrl>
  <Url><![CDATA[%s]]></Url>
  </item>
  </Articles>
  <FuncFlag>0</FuncFlag>
  </xml>";
  
 $url="http://2311156115.44c.pw/prize.php";
   $resultStr = sprintf($newsTpl, $fromUsername, $toUsername, $time,$url);
   echo $resultStr;
 
 }else{
  $keyword = trim($postObj->Content);
  $textTpl = "<xml>
 <ToUserName><![CDATA[%s]]></ToUserName>
 <FromUserName><![CDATA[%s]]></FromUserName>
 <CreateTime>%s</CreateTime>
 <MsgType><![CDATA[%s]]></MsgType>
 <Content><![CDATA[%s]]></Content>
 <FuncFlag>0</FuncFlag>
 </xml>";  
 if(!empty( $keyword ))
  {
  $msgType = "text";
   $contentStr = "請輸入:'1‘或者‘抽獎'";
   $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
   echo $resultStr;
  }else{
   $msgType = "text";
   $contentStr = "謝謝你關注sxxybbs博客,后續有精彩的內容會第一時間發送給您!回復:'1‘或者‘抽獎'得到對應的服務";
   $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
   echo $resultStr;
  }
 }

 }else {
  echo "";
  exit;
 }
 }
 
 private function checkSignature()
 {
 $signature = $_GET["signature"];
 $timestamp = $_GET["timestamp"];
 $nonce = $_GET["nonce"]; 
  
 $token = TOKEN;
 $tmpArr = array($token, $timestamp, $nonce);
 sort($tmpArr);
 $tmpStr = implode( $tmpArr );
 $tmpStr = sha1( $tmpStr );
 
 if( $tmpStr == $signature ){
 return true;
 }else{
 return false;
 }
 }
}

?>

源碼下載:刮刮卡

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持綠夏網。



主站蜘蛛池模板: 妻子的电影| 洗衣机水满了还在进水维修视频| 新民歌| 妈妈的朋友电影日本| 抖音pc端| 极地特快电影英文版| 白上关花演的电影在线观看免费| 来生缘吉他谱c调| 看黄在线看| 朴允载| 陶飞霏| 活动评价| 母亲とが话しています免费| 《生命中有你》赞美诗歌| 满天星 电视剧| 念亲恩简谱| jenna haze| 性欧美18一69性sexhd| 偷偷藏不住演员表| 行尸走肉第六季| 寡妇激情| 情人电视剧| 网络查控申请书| 恶行之外电影| 理发师的情人电影| 果戈里起点女的被劫走是多少分钟| 糖老爹| 快活电影| 不速之客美国恐怖电影2014| 出轨幻想| 打龙袍全集免费观看| 麻豆视频观看| 郭馨钰| 知否知否应是绿肥红瘦观看| 越活越来劲 电视剧| 莫斯科保卫战电影| 甲种公牛1976| 《摧花狂魔》电影| 749局啥时候上映| 色戒未| 蛇花|

!!!站長長期在線接!!!

網站、小程序:定制開發/二次開發/仿制開發等

各種疑難雜癥解決/定制接口/定制采集等

站長微信:lxwl520520

站長QQ:1737366103