相關(guān)關(guān)鍵詞
關(guān)于我們
最新文章
- PHP中opcode緩存簡(jiǎn)單用法分析
- thinkPHP控制器變量在模板中的顯示方法示例
- PHP move_uploaded_file() 函數(shù)(將上傳的文件移動(dòng)到新位置)
- dirname(__FILE__)的含義和應(yīng)用說(shuō)明
- thinkPHP5框架實(shí)現(xiàn)分頁(yè)查詢功能的方法示例
- PHP中單雙號(hào)與變量
- PHP獲得當(dāng)日零點(diǎn)時(shí)間戳的方法分析
- Laravel ORM對(duì)Model::find方法進(jìn)行緩存示例詳解
- PHP讀寫文件高并發(fā)處理操作實(shí)例詳解
- 【CLI】利用Curl下載文件實(shí)時(shí)進(jìn)度條顯示的實(shí)現(xiàn)
php實(shí)現(xiàn)評(píng)論回復(fù)刪除功能

簡(jiǎn)單的評(píng)論回復(fù)刪除功能,具體內(nèi)容如下
一、數(shù)據(jù)庫(kù)
建立兩張表,一是pinglun表;二是huifu表
效果如下:
代碼如下:
1.主頁(yè)面 main.php
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>無(wú)標(biāo)題文檔</title> <h1>朋友圈</h1> <div>內(nèi)容:</div> <div>今天很嗨</div> <div><img src="../picture/timg.jpg" width="300" height="200"></div><br> <form action="mainchuli.php" method="post"> <input type="text" hidden="hidden" value="zhangsan" name="zhangsan"> <!--因?yàn)闆](méi)有權(quán)限,這里給了一個(gè)默認(rèn)值--> <textarea name="content"></textarea><input type="submit" value="評(píng)論"><!--評(píng)論顯示的地方--><!--單擊評(píng)論提交內(nèi)容進(jìn)處理頁(yè)面--> </form> <!--?php require"DBDA.class.php"; //調(diào)用封裝類注意修改數(shù)據(jù)庫(kù)名 $db = new DBDA(); $sql ="select * from Pinglun"; $arr = $db--->query($sql,1); foreach($arr as $v) { echo" <div style="color:blue">{$v[1]} {$v[3]}</div> <div style="color:blue">{$v[2]}</div> <form action="delchuli.php?id={$v[0]}" method="post"> //刪除按鈕 <input type="submit" value="刪除"> </form> <form action="huifuchuli.php?id={$v[0]}" method="post"> //回復(fù)按鈕 <textarea name="Comment"></textarea><input type="submit" value="回復(fù)"> </form> "; $dc = new DBDA(); $sql1 ="select * from huifu where jieshouid ={$v[0]}"; //查詢回復(fù)表中的id和傳過(guò)去的id是不是一樣的 $arr1 = $dc->query($sql1,1); foreach($arr1 as $k) { echo "<div>{$k[2]} {$k[3]}</div> <div>{$k[4]}</div> "; } } ?>