Home >Backend Development >PHP Tutorial >The divisor is a single-digit division. Delete multiple static pages generated by an article under PHP.

The divisor is a single-digit division. Delete multiple static pages generated by an article under PHP.

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-29 08:43:30989browse

Copy the code The code is as follows:


//– Delete multiple static pages generated by an article
//– The generated article is named 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;
}

The above introduces the division with a single-digit divisor. Multiple static pages generated by deleting an article under PHP include the content of division with a single-digit divisor. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
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