乔丹:“我可以接受失败,但不能接受放弃!”

php无模板生成静态网页的代码

上一篇 / 下一篇  2007-06-12 23:26:33 / 个人分类:工作学习

我这个人比较懒,所以不想写静态网页模板,再说网站访问量主要在首页,就直接写个简单的代码,把首页php文件读取后保存为html就好了。呵呵,偷懒成功!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>php无模板生成静态网页</title>
</head>

<body>
<?php
   $url='http://www.chaoshiren.com.cn/2007/index.php';
  $content=file_get_contents($url);
  $file='../index.html';
  if(is_file($file)){
   unlink($file);
  }
  $fp = fopen($file,"w");
  fwrite($fp, $content);
  fclose($fp);
?>
</body>
</html>


TAG: php 模板 静态网页

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

日历

« 2008-12-26  
 123456
78910111213
14151617181920
21222324252627
28293031   

数据统计

  • 访问量: 9532
  • 日志数: 90
  • 建立时间: 2007-05-20
  • 更新时间: 2007-08-20

RSS订阅

Open Toolbar