Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 

33 rindas
761 B

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