>
以下为引用的内容: <?php /** * 留言本(M) * */ class Guestbook extends Zend_Db_Table { /** * 表名 * * var string */ protected $_name = 'gb_content'; /** * 保存 * * param array $info */ function save($info) { Zend_Loader::loadClass('Zend_Filter_StripTags'); $filter = new Zend_Filter_StripTags(); $username = trim($filter->filter($info['username'])); $content = trim($filter->filter($info['content'])); $id = intval($filter->filter($info['id'])); if ($username && $content) { $data = array( 'username' => $username, 'content' => $content, 'insert_time' => date('Y-m-d'), ); if ($id) { unset($data['insert_time']); $this->update($data,'id='.$id); } else { $this->insert($data); } return ; } } /** * 删除 * * param int $id */ function deleteItem($id) { $id = intval($id); $this->delete('id='.$id); } } ?> |