Chinaunix首页 | 论坛 | 博客
  • 博客访问: 17911954
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类:

2008-05-29 09:22:35

简单演示PHP如何使用模板生成静态页面。

模板文件templets.htm: phperz~com

以下为引用的内容:

 
    {title}
 
 
   

Hello {hello}


 

 PHP文件代码:

以下为引用的内容:

phperz.com

  $title = 'phperz';
  $hello = 'phperz.com!';
  $file = file_get_contents('templets.htm');

php程序员站


  $file = str_replace(array('{title}','{hello}'),array($title,$hello), $file);
  echo $file;

php程序员之家

?> phperz.com

阅读(439) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~