本文實例為大家分享了PHP留言板功能的具體實現代碼,供大家參考,具體內容如下
HTML代碼
<div class="continer" > <div class="head" style="background-color:rgb(217,237,247);height:50px;vertical-align:middle"><h2 style="color: rgb(81,117,114)">PHP留言本</h2></div> <div class="body"> <volist name="guestbook" id="vo"> <div class="panel"> <div class="panel-head" style="background-color: rgb(223,240,216)"> <span class="nickname" style="color: rgb(104,148,99)">留言者: {$vo.nickname}</span> <span style="color: rgb(104,148,99)">|</span> <span class="email" style="color: rgb(104,148,99)">郵箱: {$vo.email}</span> <span class="time" style="float: right;color: rgb(104,148,99)">PHP代碼
public function hierarchicalauthority(){ if(isset($_POST['liuyan'])) { $data['nickname']=$_POST['nickname']; $data['content']=$_POST['content']; $data['email']=$_POST['email']; $data['status']=1; $data['replytime']=date('Y-m-d H:i:s',time()); // print_r($data);die(); $user=M('daili_liuyan_guestbook'); $maxid=$user->max('id'); $data['id']=$maxid+1; $user->add($data); // print_r($_POST);die(); } $guestbook = D('daili_liuyan_guestbook')->select(); $this->assign('guestbook',$guestbook); $this->display(); }數據表:(表名為daili_liuyan_guestbook)
最終效果圖:
謝謝觀看~
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持。