mysql %3c%3e cdata_微信开发之微信群发消息4

本文将带你了解微信开发31----微信群发消息4,希望本文对大家学微信有所帮助。

index.php代码如下:

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)){                /*   libxml_disable_entity_loader is to prevent XML eXternal Entity   Injection,                   the best   way is to check the validity of xml by yourself */                // 使用simplexml技术对xml进行解析                 //   libxml_disable_entity_loader(true), 是从安全性考虑,为了防止xml外部注入,                //只对xml内部实体内容进行解析                libxml_disable_entity_loader(true);                //加载 postStr 字符串                $postObj =   simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);                $fromUsername =   $postObj->FromUserName;                  $toUsername = $postObj->ToUserName;                $keyword =   trim($postObj->Content);                  $time = time();                  global $tmp_arr;                                //当用户公众号有互动时,我们将会动hd_time字段更新                $connect = mysql_connect('localhost','root','root')   or die('数据库链接失败');                  mysql_select_db('wxdb',$connect);                mysql_query('set names   utf8');                $sql =   "update qf_users set hd_time='{$time}' where   openid='{$fromUsername}'";                  mysql_query($sql, $connect);                                  //根据接收到的消息类型,来进行分支处理(switch)                switch($postObj->MsgType)                {                    case 'event':                          if($postObj->Event == 'subscribe')                        {                                                          $contentStr = "欢迎关注leigood微信测试号噢";                            $resultStr =   sprintf($tmp_arr['text'], $fromUsername, $toUsername, $time,   $contentStr);                              echo $resultStr;                                                           //消息

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值