最近在做一个站点时,需要生成静态页面,但是生成的静态页面中有些内容是需要动态获取的,怎不能每天生成一下吧。。
最后上网查了一下,再加上个要总结,呵。。。。终于实现了。。发出来,大家一起研究。。呵。。。
应用一:文章计数,获取动态内容
计数页:count.php
复制代码 代码如下:
query(update .$tablepre.teacher set views=views+1 where id='.$_get['id'].');
$hello=$db->fetch_one_array(select * from .$tablepre.teacher where id='.$_get['id'].');
$hcount=$hello['views'];
?>
document.write(=$hcount?>);
静态页面mk.html中加入即可
切记:页面路径,生成静态后计数文件路径会变。。
应用二:获取此页面中一些动态信息,例如相关文章之类
同样,静态页面中的链接还是此种形式
复制代码 代码如下:
read.php里内容如下:
复制代码 代码如下:
document.write();
document.write();
document.write(订单号 );
document.write(年级科目 );
document.write(时间 );
document.write(
);
query(select * from .$tablepre.test where cid='$cid');
while($succ=$db->fetch_array($succquery))
{
?>
document.write();
document.write(=$succ['id']?> );
document.write(=$succ['city']?> );
document.write(=date('y-m-d h:i:s',$succ['addtime'])?> );
document.write(
);
document.write(
);
document.write(
);
还有另外一种方法:
static side:
复制代码 代码如下:
dynamic page:
fill in any thing that is dynamic without document.write()
http://www.bkjia.com/phpjc/320379.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/320379.htmltecharticle最近在做一个站点时,需要生成静态页面,但是生成的静态页面中有些内容是需要动态获取的,怎不能每天生成一下吧。。 最后上网查了一...