您现在的位置: yojo网页设计 >> 编程开发 >> PHP教程 >> 正文
更新时间:2007-11-18 9:38:03 文章来源:互联网 .
简单演示PHP如何使用模板生成静态页面。
模板文件templets.htm:
<html>
<head>
<title>{title}</title>
</head>
<body>
<p>Hello {hello}</p>
</body>
</html>
PHP文件代码:
<?php
$title = 'webjx';
$hello = 'webjxcom!';
$file = file_get_contents('templets.htm');
$file = str_replace(array('{title}','{hello}'),array($title,$hello), $file);
echo $file;
?>
点击: 文章地址:http://www.518web.net/bckf/php/2364.html