<span id="bqea5"></span>
<rt id="bqea5"><small id="bqea5"></small></rt>

    <label id="bqea5"><legend id="bqea5"></legend></label>
    \r\n 

    国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

    Home WeChat Applet WeChat Development PHP WeChat scratch card

    PHP WeChat scratch card

    Jan 17, 2017 am 10:02 AM

    Whether it’s a big carousel or a scratch card or a lottery, you can use the same method to calculate the probability of winning and control the amount of the prize pool. This article shares with you the PHP WeChat scratch card example code, PHP WeChat scratch card The scratch card + interface can be called directly, and it comes with a WeChat interface for everyone to learn.

    Rendering:

    PHP微信刮刮卡

    ##prize.php

    <?php
    $rand = rand(1,100);
    if($rand<10){
     $prize = &#39;蘋果1個(gè)&#39;;
    }else if($rand<30){
     $prize = &#39;蘋果2個(gè)&#39;;
    }else if($rand<60){
     $prize = &#39;蘋果3個(gè)&#39;;
    }else{
     $prize = &#39;謝謝參與&#39;;
    }
     
    ?>
     
    <!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 href="index/activity-style.css" rel="stylesheet" type="text/css">
     </head>
      
     </head>
     <body data-role="page" class="activity-scratch-card-winning">
     <script src="index/jquery.js" type="text/javascript"></script>
     <script src="index/wScratchPad.js" type="text/javascript"></script>
     <div class="main">
     <div class="cover">
     <img src="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>
     獎(jiǎng)項(xiàng)設(shè)置:
     </span>
     </div>
     <div class="Detail">
     <p>
     一等獎(jiǎng): iphone 5S 獎(jiǎng)品數(shù)量:60
     </p>
     <p>
     二等獎(jiǎng): ipad mini2 獎(jiǎng)品數(shù)量:100
     </p>
     <p>
     三等獎(jiǎng): 金士頓16G手機(jī)卡 獎(jiǎng)品數(shù)量:2000
     </p>
     </div>
     </div>
     </div>
      
     <div class="boxcontent boxwhite">
     <div class="box">
     <div class="title-brown">
     活動(dòng)說(shuō)明:
     </div>
     <div class="Detail">
     <p class="red">
     中獎(jiǎng)用戶請(qǐng)準(zhǔn)確將收貨地址發(fā)送給我,我們將以貨到付款的方式郵寄給你!
     </p>
     <p>
     親,祝您好運(yùn)哦!<a href="http://2311156115.44c.pw/prize.php">再來(lái)一次</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, &#39;SimpleXMLElement&#39;, LIBXML_NOCDATA);
     $fromUsername = $postObj->FromUserName;
      $toUsername = $postObj->ToUserName;
     $time = time();
      
     if($postObj->Content == &#39;1&#39;){
     $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 = &#39;text&#39;;
     $contentStr = "你輸入了:1";
     $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
       echo $resultStr;
      
     }else if($postObj->Content == &#39;抽獎(jiǎng)&#39;){
     $newsTpl ="<xml>
      <ToUserName><![CDATA[%s]]></ToUserName>
      <FromUserName><![CDATA[%s]]></FromUserName>
      <CreateTime>%s</CreateTime>
      <MsgType><![CDATA[news]]></MsgType>
      <ArticleCount>1</ArticleCount>
      <Articles>
      <item>
      <Title><![CDATA[刮刮樂(lè)翻天]]></Title> 
      <Description><![CDATA[我就要去刮刮樂(lè),抽獎(jiǎng)去!]]></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 = "請(qǐng)輸入:&#39;1‘或者‘抽獎(jiǎng)&#39;";
       $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
       echo $resultStr;
      }else{
       $msgType = "text";
       $contentStr = "謝謝你關(guān)注sxxybbs博客,后續(xù)有精彩的內(nèi)容會(huì)第一時(shí)間發(fā)送給您!回復(fù):&#39;1‘或者‘抽獎(jiǎng)&#39;得到對(duì)應(yīng)的服務(wù)";
       $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;
     }
     }
    }
     
    ?>

    The above is the entire content of this article , I hope it will be helpful to everyone's learning, and I also hope that everyone will support the PHP Chinese website.

    For more PHP WeChat scratch card related articles, please pay attention to the PHP Chinese website!

    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

    Hot AI Tools

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Clothoff.io

    Clothoff.io

    AI clothes remover

    Video Face Swap

    Video Face Swap

    Swap faces in any video effortlessly with our completely free AI face swap tool!

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    Hot Topics

    PHP Tutorial
    1502
    276