Home >Backend Development >PHP Tutorial >Static php page, obtain page cache and generate HTML page

Static php page, obtain page cache and generate HTML page

WBOY
WBOYOriginal
2016-07-28 08:27:061098browse

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.

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
Previous article:PHP post getNext article:PHP post get