public function save() { //dump($_POST);exit; if ($_POST['title'] == '' || $_POST['text'] == '') { $this->error('标题或者内容不能为空!'); } $map['id'] = $_POST['id']; $db = new ArticlesModel(); $data = array('title' => Input::safeHtml($_POST['title'])); $id = $db->where($map)->save($data); if ($id === false || $id === null) { $this->error('保存文章基本信息时出现错误' . $db->getError()); } //存入日志内容信息 $db = new ArticlesContentModel(); unset($data); $data = array('text' => str_replace('\\', '', str_replace(""", '', $_POST['text']))); $rs = $db->where($map)->save($data); if ($rs === false || $rs === null) { $this->error('保存文章内容时出现错误:' . $db->getError()); } $this->redirect('Note/view/id/' . $map['id']); }