欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-10-06 17:16:28
复制代码 代码如下: //– 删除一篇文章生成的多个静态页面 //– 生成的文章名为 5.html 5_2.html 5_3.html /*————————————————...
复制代码 代码如下:

//– 删除一篇文章生成的多个静态页面
//– 生成的文章名为 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.$article_id.'_'.$n.'.html';
}
}
return false;
}