在Smarty模板引擎格式化时间戳
smarty 常量输出:
{$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}
Thinkphp模板引擎格式化方法:
{$create_time|date="Y-m-d",###}
或者是在CommonAction 里定义这样的函数
function toDate($time,$format='Y-m-d H:i:s ') { if( empty($time)) { return ''; } $format = str_replace('#',':',$format); return date(auto_charset($format),$time); }
模板实例
{$create_time|toDate='y-m-d H#i'}
| anyShare分享到: | |
| |










There are no comments yet
Log in to post a comment.