public function add($content) { $time = intval(RECORD_DAYS_MESSAGE) * 24; $time = '-' . strval($time) . ' hour'; $time = date('Y-m-d', strtotime($time, time())); $sql = "DELETE FROM `wx_message` WHERE `time` <= '{$time}'"; $this->delete($sql); $content = str_replace("'", "''", $content); $sql = "INSERT INTO `wx_message` (`openid`, `content`, `type`) VALUES ('{$this->fromUserName}','{$content}', 'rcv')"; $this->insert($sql); include_once dirname(__FILE__) . '/user/info.php'; $info = new UserInfo($this->fromUserName); $info->load(); }