|
这是一个增加评论的功能代码如下:
PHP复制代码
//提交评论
function add_comments () {
$submit = $this->input->post("submit");
$r_id = $this->input->post("resource_id",TRUE);
$login_name = $this->input->post("login_name",TRUE);
if (empty($login_name)) {
$login_name = "无名氏";
}
$content = $this->input->post("content",TRUE);
if ($submit) {
$datestring = "%Y-%m-%d %H:%i:%s";
$time = time();
$create_date = mdate ($datestring, $time);
if (empty($content)) {
redirect ("single?id=" . $r_id);
} else {
$query = $this->m_single->do_add_comments($r_id, $login_name, $content, $create_date);
if ($query) {
redirect ("single?id=" . $r_id);
} else {
redirect ("single?id=" . $r_id);
}
}
}
}
复制代码
|
|