ThinkPHP示例之:使用第三方模板引擎
这里以Smarty模板引擎举例在ThinkPHP里面的使用用法。|
{literal}变量输出:
{$var}
关联数组输出: id:{$array.id} name:{$array.name} email:{$array.email} smarty 常量输出: {$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}
条件判断
Foreach循环输出
变量输出:
{$var} 关联数组输出: id:{$array.id} name:{$array.name} email:{$array.email} smarty 常量输出: {$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}
条件判断
Foreach循环输出 |
| 示例源码 配置文件config.php {php} highlight_file(CONFIG_PATH.'config.php');{/php} Smarty模板引擎插件 {php} highlight_file(THINK_PATH.'PlugIns/SmartyTemplate/SmartyTemplate.php');{/php} 控制器IndexAction类 {php} highlight_file(LIB_PATH.'Action/IndexAction.class.php');{/php} |