Home > Backend Development > PHP Tutorial > php下删除一篇文章生成的多个静态页面_PHP

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

WBOY
Release: 2016-06-01 12:18:08
Original
711 people have browsed it
复制代码 代码如下:
//– 删除一篇文章生成的多个静态页面
//– 生成的文章名为 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;
}
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template