php编程小结

Example 5-8. date_format[日期格式]

index.php:

$smarty = new Smarty;
$smarty->assign('yesterday', strtotime('-1 day'));
$smarty->display('index.tpl');

index.tpl:

{$smarty.now|date_format}
{$smarty.now|date_format:"%A, %B %e, %Y"}
{$smarty.now|date_format:"%H:%M:%S"}
{$yesterday|date_format}
{$yesterday|date_format:"%A, %B %e, %Y"}
{$yesterday|date_format:"%H:%M:%S"}

输出结果:

Feb 6, 2001
Tuesday, February 6, 2001
14:33:00
Feb 5, 2001
Monday, February 5, 2001
14:33:00

smarty加入PHP代码:
{php}
...
{/php}
Posted in PHP | Leave a comment

研究一下smarty的模板机制。

如果要写一套模板引擎,怎么实现?

Posted in 未分类 | Leave a comment

天气好热啊

36度高温,要买空调了!

Posted in 未分类 | Leave a comment

坐巴士网博客

记录点点滴滴的博客……

Posted in 未分类 | 1 Comment