Chinaunix首页 | 论坛 | 博客
  • 博客访问: 744432
  • 博文数量: 280
  • 博客积分: 10106
  • 博客等级: 上将
  • 技术积分: 3052
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-31 17:10
文章分类

全部博文(280)

文章存档

2011年(2)

2010年(4)

2009年(4)

2008年(62)

2007年(208)

我的朋友

分类:

2007-11-12 10:42:22

简单演示PHP如何使用模板生成静态页面。
模板文件templets.htm:

 
    {title}
 
 
   

Hello {hello}


 
 PHP文件代码:
  $title = 'webjx';
  $hello = 'webjxcom!';
  $file = file_get_contents('templets.htm');
  $file = str_replace(array('{title}','{hello}'),array($title,$hello), $file);
  echo $file;
?>
 
阅读(404) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~