smarty直接在模板中格式化时间的方法

smarty提供了一个获取时间戳的方法:

<%$smarty.now%>

使用该方法获取到当时的时间戳之后,使用格式化修饰符data-format进行修饰:

<%$smarty.now|data-format:"%Y-%m-%d %H:%M:%S"%>

'%Y-%m-%d %H:%M:%S'
原文地址:https://www.cnblogs.com/charling/p/3442508.html