include("../conn.php");
$url=$_GET['url'];//URL address
$uid=$_GET['uid'];//id value
function get_center($url_id,$uid){
// $c//Get the content from the cache
$url=$url_id;
$id=$uid;
$c//Assign the cached content to a variable
ob_end_clean();//Close cache and clear
/***End of caching***/
file_put_contents("../".$id.".html", $content);
}
$sql="select * from article where id=".$uid."";
$query=mysql_query($sql);
$rs=mysql_fetch_array($query);
if($rs["url"]==''){
get_center($url,$uid);
$sql="UPDATE article SET url='localhost/weizhuan/".$uid.".html' WHERE id = ".$uid."";
//$sql= "UPDATE article SET FirstName = 'Fred' WHERE LastName = 'Wilson' ";
@mysql_query($sql) or die("sql have err");
echo "<script> alert('HTML file generated successfully') ; window.location.href='all_article.php'</script>";
}else{
get_center($url,$uid);
$sql="UPDATE article SET url='localhost/weizhuan/". $uid.".html' WHERE id = ".$uid."";
//$sql="UPDATE article SET FirstName = 'Fred' WHERE LastName = 'Wilson' ";
@mysql_query($sql) or die ("sql have err");
echo "<script> alert('HTML already exists and the original file has been overwritten. '); window.location.href='all_article.php'</script>";
}
?>
The above has introduced the staticization of PHP pages, obtaining page cache and generating HTML pages, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.