php手动加载视图文件
test.php:
<?php$title = "测试标题";$a = require 'test.html';$a = exec($a);echo $a;
test.html:
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title><?php echo $title;?></title></head><body><?php for($i = 0;$i < 10;$i++):?> <p><?php echo $i;?></p><?php endfor;?></body></html>
关于smarty模板:
smarty是在类中进行操作的,通过正则把 test.html 中的变量找出来,然后赋值给smarty中的变量,间接的给模板赋值
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。