PHP 自定义 Smarty 模板引擎类 高洛峰 细说PHP
smarty模板引擎类简单工作原理利用Smarty 模板引擎类对模板文件中的变量进行编译,编译过程其实就是利用正则表达式翻译成PHP文件。例如 模板文件中{$title} 利用正则表达式找到并替换成
自定义 Smarty 模板引擎类 smarty.class.php页面
$rep = "";
$newhtml = preg_replace($reg, $rep, $html);
file_put_contents($comfile, $newhtml);
}
include $comfile;
}
} 调用模板页面 index.php
页:
[1]