加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > PHP > 正文

php下删除一篇文章生成的多个静态页面

发布时间:2020-05-24 21:05:05 所属栏目:PHP 来源:互联网
导读:php自定义函数之删除一篇文章生成的多个静态页面,可能有多页的文章,都是需要考虑到的。

<div class="codetitle"><a style="CURSOR: pointer" data="17385" class="copybut" id="copybut17385" onclick="doCopy('code17385')"> 代码如下:<div class="codebody" id="code17385">
//– 删除一篇文章生成的多个静态页面
//– 生成的文章名为 5.html 5_2.html 5_3.html
/—————————————————— /
function delStaticHtml ($article_id)
{
global $db;
$sql = “SELECT post_time FROM @__article WHERE article_id = ‘{$article_id}'”;
$art = $db->getOne ($sql);
if ($art)
{
$n = 1;
$html_dir = ‘../html/'.date(‘Ym',$art['post_time']).'/';
$filename = $html_dir.$article_id.'.html';
while (file_exists($filename))
{
@unlink($filename);
$n++;
$filename = $html_dir.$articleid.''.$n.'.html';
}
}
return false;
}

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读