久久机这里只有精品,国产69精品一区二区亚洲孕妇,91精品国产综合久久婷婷香蕉,午夜久久久久久电影

最新活動:電腦PC端+手機端+微網(wǎng)站+自適應(yīng)網(wǎng)頁多模板選擇-建站388元起價!!!
當前位置:主頁 > 網(wǎng)站建設(shè) > Dede 刪除文檔同時文章中的圖片的方法,dedecms

Dede 刪除文檔同時文章中的圖片的方法,dedecms

時間:2023-07-19 09:07:19 閱讀: 文章分類: 網(wǎng)站建設(shè) 作者: 織夢網(wǎng)站員

導(dǎo)讀:dedecmsdedecmsDede刪除文檔同時刪除文章中的圖片,這個功能對于做圖片網(wǎng)站的朋友來說非常重要,特別是在刪除采集回來的文章時,會產(chǎn)生很多無用的圖片. 本程序不保證能夠100%的dede后臺模板織夢手機模板。

dede后臺模板織夢手機模板首先,在"/include"目錄下建立"extend.func.php"文件. 然后,將以下內(nèi)容保存在"extend.func.php"文件中,一共三個函數(shù): //解析body數(shù)據(jù),獲得所有圖片的絕對地址 function GetPicsTruePath($body,$litpic) { $delfiles = array();//存儲圖片地址數(shù)據(jù) if(!empty($litpic)) { $litpicpath = GetTruePath(); $litpicpath .= $litpic; $delfiles[] = $litpicpath;//縮略圖地址 } preg_match_all("/src=[\"|'|\S|\s]([^ title="liehuo.net" |\/|>]*){0,}(([^>]*)\.(gif|jpg|png))/isU",$body,$tmpdata); $picspath = array_unique($tmpdata[2]);//body中所有圖片的地址 foreach($picspath as $tmppath) { $path = GetTruePath();//獲得絕對路徑 $picpath = preg_replace("/[a-zA-z]+:\/\/[^ |\/|\s]*/",'',$tmppath);//去掉網(wǎng)址部分 $path .=$picpath; $delfiles[] = $path;//保存處理后的數(shù)據(jù) } return $delfiles; } //獲得文章Body數(shù)據(jù) function GetArcBody($aid) { global $dsql; $query = "SELECT [url=mailto:dede_addonarticle.body]dede_addonarticle.body[/url] FROM [url=mailto:%60dede_addonarticle]`dede_addonarticle[/url]` WHERE [url=mailto:dede_addonarticle.aid]dede_addonarticle.aid[/url] = '$aid'"; $row = $dsql->GetOne($query); if(is_array($row)) return $row; else return false; } //寫入日志文件 function WriteToDelFiles($msg)//刪除文章的時候會通過此函數(shù)記錄日志 { if(empty($msg)) $savemsg="未獲得消息"; else $savemsg = $msg; $errorFile = dirname(__FILE__).'/../data/del_body_file.txt';//刪除記錄文件 $fp = @fopen($errorFile, 'a'); @fwrite($fp,"\r\n{$savemsg}"); @fclose($fp); } 接下來打開"/dede/inc/inc_batchup.php"文件。 1:在33行下方加入,也就是"$arcRow = $dsql->GetOne($arcdede模板堂Query);"下方: $arcBodyRow = GetArcBody($aid); 2:在138行下方加入,也就是"return true;"上方: //解析Body中夢織模板的資源,并刪除 $willDelFiles = GetPicsTruePath($arcBodyRow['body'],$arcRow['litpic']); $nowtime = time(); $executetime = MyDate('Y-m-d H:i:s',$nowtime);//獲得執(zhí)行時間 $msg = "\r\n文章標題:$arcRow[title]"; WriteToDelFiles($msg); if(!empty($willDelFiles)) { foreach($willDelFiles as $file) { if(file_exists($file) && !is_dir($file)) { if(unlink($file)) $msg = "\r\n位置:$file\r\n結(jié)果:刪除成功!\r\n時間:$executetime"; else $msg = "\r\n位置:$file\r\n結(jié)果:刪除失敗!\r\n時間:$executetime"; } else $msg = "\r\n位置:$file\r\n結(jié)果:文件不存!\r\n時間:$executetime"; WriteToDelFiles($msg); }//END foreach } else { $msg = "\r\n未在Body中解析到數(shù)據(jù)\r\nBody原始數(shù)據(jù):$arcBodyRow[bod織夢模板y]\r\n時間:$executetime"; WriteToDelFiles($msg); } 至此,全部修改完成,刪除文章時,程序會分析Body中的圖片地址,然后刪除.并在/data/目錄下,產(chǎn)生日志記錄文件:del_body_file.txt。相關(guān)dede后臺模板織夢手機模板。

關(guān)鍵詞標簽: 標簽 dedecms 文檔

聲明: 本文由我的SEOUC技術(shù)文章主頁發(fā)布于:2023-07-19 ,文章Dede 刪除文檔同時文章中的圖片的方法,dedecms主要講述標簽,文檔,dedecms網(wǎng)站建設(shè)源碼以及服務(wù)器配置搭建相關(guān)技術(shù)文章。轉(zhuǎn)載請保留鏈接: http://www.bifwcx.com/article/web_30159.html

我的IDC 網(wǎng)站建設(shè)技術(shù)SEOUC.COM
專注網(wǎng)站建設(shè),SEO優(yōu)化,小程序設(shè)計制作搭建開發(fā)定制網(wǎng)站等,數(shù)千家網(wǎng)站定制開發(fā)案例,網(wǎng)站推廣技術(shù)服務(wù)。
  • 5000+合作客服
  • 8年從業(yè)經(jīng)驗
  • 150+覆蓋行業(yè)
  • 最新熱門源碼技術(shù)文章

    主站蜘蛛池模板: 桃园市| 贺州市| 泸州市| 二连浩特市| 浦东新区| 桦南县| 宁远县| 天长市| 永城市| 依兰县| 闸北区| 中卫市| 集贤县| 安化县| 乐至县| 黄山市| 高唐县| 汉寿县| 镇巴县| 镇雄县| 景洪市| 福鼎市| 德格县| 长宁县| 武宣县| 襄樊市| 许昌县| 泰安市| 富阳市| 呼和浩特市| 德安县| 沁水县| 宁南县| 霍山县| 天峻县| 安仁县| 科尔| 垫江县| 遵化市| 闽侯县| 腾冲县|