|
當(dāng)前最新版本:2.6.18
解壓后將目錄中的libs目錄重命名為smarty,復(fù)制到你的網(wǎng)站目錄,同時(shí)在網(wǎng)站根目錄下建立templates和templates_c兩個(gè)目錄
建立test.php,內(nèi)容如下:
<?php
include_once('./Smarty/Smarty.class.php');$smarty = new Smarty();
$smarty -> template_dir = "./templates"; //模板存放目錄
$smarty -> compile_dir = "./templates_c"; //編譯目錄
$smarty -> left_delimiter = "{{"; //左定界符
$smarty -> right_delimiter = "}}"; //右定界符
$smarty -> assign('test','OK');
$smarty -> display('test.html');
?>
給templates_c權(quán)限755
在templates目錄下新建test.html:
<html>
<head>
</head>
<body>
{{$test}}
</body>
</html>
打開test.php,如果看到OK就說明你的smarty安裝成功了!
php技術(shù):Smarty安裝配置方法,轉(zhuǎn)載需保留來源!
鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。