在插件目录plugins里新建文件 modifier.插件名.php文件(如 modifier.插件名.php)
例:function smarty_modifier_test($utime, $format){ return date($format,$utime);}tpl中新建datetime.html,内容:{$time|test:'Y-m-d H:i:s'}index.php内容如下:
left_delimiter = "{"; $smarty->right_delimiter = "}";$smarty->template_dir ="tpl";$smarty->compile_dir ="template_c";$smarty->cache_dir ="cache";//开启缓存的另两个配置$smarty->caching =true;$smarty->cache_lifetime =120; $smarty->assign('time',time());$smarty->display('datetime.html');?>