您的位置:首页 > 编程语言 > PHP开发

php中模版生成html的原理

2012-08-31 17:43 260 查看
//打开模版文件
$file=fopen('temp.html','r');
$html_content=fread($file,filesize('temp.html'));
//替换模版标签
$php_content=str_replace('{','<?php echo ',$html_content);
$php_content=str_replace('}',';?>',$php_content);
//新建php模版文件
$php_temp=fopen('temp.php','w');
fwrite($php_temp,$php_content);
//赋值
$title='temp';
$content='temp';
include('temp.php');
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: