久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      dedecms怎么刪除文章同時也刪除附件

      dedecms怎么刪除文章同時也刪除附件

      dedecms怎么刪除文章同時也刪除附件?

      dedecms刪除文章同時也刪除附件的修改方法

      dedecms刪除文章同時也刪除附件的修改方法,使用dedecms的朋友可以參考下。

      推薦學(xué)習(xí):織夢cms

      首先添加兩個函數(shù)

      代碼如下:

      /*  根據(jù)文檔id獲取文檔的body部分  */  function getArcBody($arcid)  {  global $dsql;  if(empty($arcid)) return ;  $body = '';  $query = "select arc.*,ch.addtable,ch.fieldset from `dede_arctiny` as arc left join `dede_channeltype` as ch on arc.channel=ch.id where arc.id=$arcid";  $row = $dsql->GetOne($query);  if(empty($row)) return ;  $addtable = $row['addtable'];  $fieldset = $row['fieldset'];  include_once(DEDEINC.'./dedetag.class.php');  $dtp = new DedeTagParse();  $dtp->SetNameSpace('field','<','>');  $dtp->LoadSource($fieldset);  if(is_array($dtp->CTags))  {  foreach($dtp->CTags as $tid=>$tag)  {  if($tag->GetAtt('type')=='htmltext')  {  $body = $tag->GetName();  break;  }  }  }  if(!empty($body))  {  $query = "select $body from `$addtable` where aid=$arcid";  $row = $dsql->GetOne($query);  $body = $row[$body];  return $body;  }  return ;  }  /*  解析文檔內(nèi)容的本地圖片圖片  */  function get_img_from_body($body)  {  $result = array();  if(empty($body))  return $result;  preg_match_all('/ssrc=(["|'])([^1]*?).(gif|jpg|jpeg|png)1/',$body,$res);  if(!empty($res[2]))  {  foreach($res[2] as $k=>$v)  {  $result[] = $v.'.'.$res[3][$k];  }  }  return $result;  }

      把這段代碼貼到include/common.func.php后面,

      接著打開后臺(假設(shè)使用默認(rèn)的dede作為后臺)dede/inc/inc_batchup.php文件,

      在第22行添加代碼如下:

      $body = getArcBody($aid);

      接在在第139行,就是在

      return true;

      上面一行加上下面的代碼

      代碼如下:

      if($body)  {  $img_arr = get_img_from_body($body);  if(!empty($img_arr))  {  foreach($img_arr as $v)  {  $img_file = GetTruePath().str_replace($GLOBALS['cfg_basehost'],'',$v);  if(file_exists($img_file) && !is_dir($img_file))  @unlink($img_file);  }  }  }

      這樣就可以實(shí)現(xiàn)刪除文檔的時候刪除字段為“htmltext”類型的中的本地圖片了。

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號