$smarty = new Smarty;
//下面的(你的网站目录)用绝对路径,可以用相对路径(./templates)
$smarty->template_dir='C:\Apache2\htdocs\mysmarty\templates';
$smarty->config_dir='C:\Apache2\htdocs\mysmarty\configs';
$smarty->cache_dir='C:\Apache2\htdocs\mysmarty\cache';
$smarty->compile_dir='C:\Apache2\htdocs\mysmarty\templates_c';
//上面四行为使用Smarty前的必要参数配置
$smarty->assign('name','明天');
$smarty->display('index.tpl');
?>
index.tpl
<html>
<body>
你好,{$name}!
</body>
</html>
7、现在终于可以浏览自己的作品。运行index.php
