responseMsg(); if (!$array){ exit; } $msgtype=$array['MsgType']; switch ($msgtype){ case "event": write_log("index--event--有接口调用"); $result=$wechat->eventMsg($array); //$wechat->insertOpenid($array,$array['Event']); break; case "text": write_log("index--text--有接口调用"); $result=$wechat->textMsg($array); //echo $result; break; } echo $result; function write_log($activation){ $dir="./Log"; if (!is_dir($dir)){ mkdir($dir); } $open=fopen($dir."/log.txt","a"); fwrite($open,date("Y-m-d H:i:s")."\t".$activation."\r\n"); fclose($open); }