当前位置: 首页 > 工具软件 > Smarty > 使用案例 >

$smarty.now

姬烨磊
2023-12-01

{$smarty}保留变量——{$smarty.now}

例子:

variables.tpl

<{config_load file="a.conf"}>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body bgcolor=<{#bgcolor#}>>

现在的时间是:<{$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}>
</body>
</html>


variables.php


<?php
include("libs/Smarty.class.php");
$smarty=new Smarty();
$smarty->config_dir="demo/config";
$smarty->reInitSmarty("demo/templates","demo/templates_c");
$smarty->display("variables.tpl");


?>

 类似资料:

相关阅读

相关文章

相关问答