国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > PHP > 正文

PHP微信刮刮卡 附微信接口

2020-03-22 18:25:59
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
無(wú)論大轉(zhuǎn)盤也好,或者是刮刮卡都是抽獎(jiǎng)都可以利用同樣的方法來(lái)計(jì)算中獎(jiǎng)的概率和控制獎(jiǎng)池的數(shù)量,本文為大家分享了PHP微信刮刮卡實(shí)例代碼,PHP微信刮刮卡+接口,可直接調(diào)用,自帶微信接口,供大家學(xué)習(xí)。效果圖:prize.php$rand = rand(1,100);if($rand 10){ $prize = '蘋果1個(gè)';}else if($rand 30){ $prize = '蘋果2個(gè)';}else if($rand 60){ $prize = '蘋果3個(gè)';}else{ $prize = '謝謝參與';
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" script src="index/jquery.js" type="text/javascript" /script script src="index/wScratchPad.js" type="text/javascript" /script div div img src="index/activity-scratch-card-bannerbg.png" div id="prize" php echo $prize; /div div id="scratchpad" /div /div div div div span 獎(jiǎng)項(xiàng)設(shè)置: /span /div div 一等獎(jiǎng): iphone 5S 獎(jiǎng)品數(shù)量:60 二等獎(jiǎng): ipad mini2 獎(jiǎng)品數(shù)量:100 三等獎(jiǎng): 金士頓16G手機(jī)卡 獎(jiǎng)品數(shù)量:2000 /div /div /div div div div 活動(dòng)說(shuō)明: /div div 中獎(jiǎng)用戶請(qǐng)準(zhǔn)確將收貨地址發(fā)送給我,我們將以貨到付款的方式郵寄給你! 親,祝您好運(yùn)哦! a 再來(lái)一次 /a /div /div /div /div div /div /div script type="text/javascript" window.sncode = "null"; $(function() { $("#scratchpad").wScratchPad({ width: 150, height: 40, color: "#a9a9a7", /script /body /html sxxybbs_wx.php * wechat php test//define your tokendefine("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 == '抽獎(jiǎng)'){ $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)輸入:'1‘或者‘抽獎(jiǎng)'"; $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr); echo $resultStr; }else{ $msgType = "text"; $contentStr = "謝謝你關(guān)注sxxybbs博客,后續(xù)有精彩的內(nèi)容會(huì)第一時(shí)間發(fā)送給您!回復(fù):'1‘或者‘抽獎(jiǎng)'得到對(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;
源碼下載:刮刮卡以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持phpstudy。PHP教程

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 于都县| 项城市| 江城| 宁城县| 黄大仙区| 拜泉县| 甘泉县| 阳东县| 南靖县| 彰化县| 潮安县| 延边| 呼伦贝尔市| 平阴县| 聂荣县| 奇台县| 吉木乃县| 长乐市| 于都县| 汤原县| 海城市| 永靖县| 柯坪县| 罗山县| 科技| 宣汉县| 南涧| 怀柔区| 惠安县| 广饶县| 随州市| 萨嘎县| 秦皇岛市| 枣庄市| 浦江县| 靖宇县| 察雅县| 长沙市| 瓮安县| 资溪县| 泸州市|