You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

35 lines
821 B

  1. <?php
  2. //调用
  3. require_once './Common/Config.php';
  4. require_once './Common/WeChat.class.php';
  5. require_once './Common/driver_config.php';
  6. write_log("index接口有调用");
  7. $wechat=new WeChat(APPID,APPSECRET);
  8. $array=$wechat->responseMsg();
  9. if (!$array){
  10. exit;
  11. }
  12. $msgtype=$array['MsgType'];
  13. $result = false;
  14. switch ($msgtype){
  15. case "event":
  16. write_log("index--event--有接口调用");
  17. $result=$wechat->eventMsg($array);
  18. //$wechat->insertOpenid($array,$array['Event']);
  19. break;
  20. case "text":
  21. write_log("index--text--有接口调用");
  22. $result=$wechat->textMsg($array);
  23. //echo $result;
  24. break;
  25. }
  26. echo $result;
  27. function write_log($activation){
  28. $dir="./Log";
  29. if (!is_dir($dir)){
  30. mkdir($dir);
  31. }
  32. $open=fopen($dir."/log.txt","a");
  33. fwrite($open,date("Y-m-d H:i:s")."\t".$activation."\r\n");
  34. fclose($open);
  35. }