PHP如何实现微信刮刮卡-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

PHP如何实现微信刮刮卡

这篇文章将为大家详细讲解有关PHP如何实现微信刮刮卡,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:空间域名、虚拟空间、营销软件、网站建设、迎江网站维护、网站推广。

效果图:

PHP如何实现微信刮刮卡

prize.php


 


 
 
 
 
 
 
 刮刮卡
 
 
  
 
 
 
 
 
 
  
 
  
    
            奖项设置:        

 一等奖: iphone 5S 奖品数量:60  

 

 二等奖: ipad mini2 奖品数量:100  

 

 三等奖: 金士顿16G手机卡 奖品数量:2000  

                活动说明:        中奖用户请准确将收货地址发送给我,我们将以货到付款的方式邮寄给你!  

 

 亲,祝您好运哦!再来一次  

                    window.sncode = "null";  $(function() {  $("#scratchpad").wScratchPad({  width: 150,  height: 40,  color: "#a9a9a7",     });  });         

sxxybbs_wx.php

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 = "
 
 
 %s
 
 
 0
 "; 
 $msgType = 'text';
 $contentStr = "你输入了:1";
 $resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $msgType, $contentStr);
   echo $resultStr;
  
 }else if($postObj->Content == '抽奖'){
 $newsTpl ="
  
  
  %s
  
  1
  
  
  <![CDATA[刮刮乐翻天]]> 
  
  
  
  
  
  0
  ";
   
 $url="http://2311156115.44c.pw/prize.php";
   $resultStr = sprintf($newsTpl, $fromUsername, $toUsername, $time,$url);
   echo $resultStr;
  
 }else{
  $keyword = trim($postObj->Content);
  $textTpl = "
 
 
 %s
 
 
 0
 ";  
 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;
 }
 }
}
 
?>

关于“PHP如何实现微信刮刮卡”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。


文章标题:PHP如何实现微信刮刮卡
网页URL:http://kswsj.cn/article/jepdeg.html