malike 发表于 2018-2-11 12:13:58


            本文实例讲述了PHP Smarty模版简单使用方法。分享给大家供大家参考,具体如下:
Index.php:
require('../libs/Smarty.class.php');
$smarty = new Smarty;
// 添加自定义调节器
$smarty->registerPlugin("modifier", "e", "htmlspecialchars");
$smarty->registerPlugin("modifier", "trim", "trim");
//$smarty->force_compile = true;
$smarty->debugging = true;
$smarty->caching = true;
$smarty->cache_lifetime = 120;
//定义标识符
$smarty->left_delimiter = '{ ';
$smarty->right_delimiter = ' }';
//绑定变量
$smarty->assign("test_html", "haha");
$smarty->display('index.tpl');
页: [1]
查看完整版本: PHP Smarty模版简单使用方法