php页面静态化 获取页面缓存生成HTML页面
程序员文章站
2022-03-23 17:32:19
...
include("../conn.php");
$url=$_GET['url'];//URL地址
$uid=$_GET['uid'];//id值
function get_center($url_id,$uid){
// $c//从缓存中获取内容
$url=$url_id;
$id=$uid;
$c//吧缓存的内容赋值给一个变量
ob_end_clean();//关闭缓存并清空
/***缓存结束***/
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 "";
}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 "";
}
?>
$url=$_GET['url'];//URL地址
$uid=$_GET['uid'];//id值
function get_center($url_id,$uid){
// $c//从缓存中获取内容
$url=$url_id;
$id=$uid;
$c//吧缓存的内容赋值给一个变量
ob_end_clean();//关闭缓存并清空
/***缓存结束***/
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 "";
}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 "";
}
?>
以上就介绍了 php页面静态化 获取页面缓存生成HTML页面,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。