微信网页扫二维码带参数

public function index(){
  $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
  $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
  $toUsername = $postObj->ToUserName;//公众号的微信号
  $fromUsername = $postObj->FromUserName;//用户的微信号
  $MsgType = $postObj->MsgType;//消息类型
  $Event = $postObj->Event;//事件类型 首次关注=subscribe 已关注 SCAN
  $EventKey = $postObj->EventKey;//事件key值
  file_put_contents('weixinv.txt', '公众号微信号='.$toUsername.' 用户公众号='.$fromUsername.' 消息类型='.$MsgType.' 事件类型='.$Event.' 事件key值='.$EventKey,FILE_APPEND);

 


  exit(htmlspecialchars($_GET['echostr']));

}

posted @ 2019-08-05 15:23  古语的月  阅读(588)  评论(0编辑  收藏  举报