您的位置:首页 > 其它

Smarty的保留变量

2017-11-22 11:04 302 查看
一 代码

index.php

<?php
include '../config.php';
$smarty->assign('title','Smarty保留变量');
$smarty->display('3/index.tpl');
?>

 
index.tpl

<!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=gb2312" />
<title>{ $title }</title>
<link rel="stylesheet" href="../css/style.css" />
</head>
<body>
{* 使用get变量获取url中的变量值(ex: http://localhost/tm/sl/28/3/index.php?type=computer)*} 变量type的值是:{ $smarty.get.type }<br />
当前路径为:{ $smarty.server.PHP_SELF}<br />
当前时间为:{$smarty.now}
</body>
</html>

 

二 运行结果

变量type的值是:
当前路径为:/test/29/3/index.php
当前时间为:1492600251
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: