Smarty安裝配置方法
更新時(shí)間:2008年04月10日 23:14:08 作者:
下載最新的Smarty最簡(jiǎn)單的測(cè)試?yán)?,以測(cè)試smarty是否安裝成功
下載最新的Smarty:http://smarty.php.net/
當(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就說(shuō)明你的smarty安裝成功了!
當(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就說(shuō)明你的smarty安裝成功了!
您可能感興趣的文章:
相關(guān)文章
PHP 數(shù)字左側(cè)自動(dòng)補(bǔ)0
舉例來(lái)說(shuō):?jiǎn)T工的工號(hào) X001 雖然 MySQL 本身的字段設(shè)定成 zerofill 的屬性時(shí),會(huì)將不足位數(shù)的部份補(bǔ)上0,但是這個(gè)功能只能用在數(shù)字的字段上面。 所以必要的時(shí)候只好靠PHP來(lái)進(jìn)行了。2008-03-03PHP實(shí)現(xiàn)圖的鄰接矩陣表示及幾種簡(jiǎn)單遍歷算法分析
這篇文章主要介紹了PHP實(shí)現(xiàn)圖的鄰接矩陣表示及幾種簡(jiǎn)單遍歷算法,結(jié)合實(shí)例形式分析了php基于鄰接矩陣實(shí)現(xiàn)圖的定義及相關(guān)遍歷操作技巧,需要的朋友可以參考下2017-11-11學(xué)習(xí)php設(shè)計(jì)模式 php實(shí)現(xiàn)訪問者模式(Visitor)
這篇文章主要介紹了php設(shè)計(jì)模式中的訪問者模式,使用php實(shí)現(xiàn)訪問者模式,感興趣的小伙伴們可以參考一下2015-12-12php實(shí)現(xiàn)的Timer頁(yè)面運(yùn)行時(shí)間監(jiān)測(cè)類
這篇文章主要介紹了php實(shí)現(xiàn)的Timer頁(yè)面運(yùn)行時(shí)間監(jiān)測(cè)類,可實(shí)現(xiàn)按不同key檢測(cè)不同的運(yùn)行時(shí)間,需要的朋友可以參考下2014-09-09深入理解PHP的遠(yuǎn)程多會(huì)話調(diào)試
這篇文章主要給大家介紹了關(guān)于PHP遠(yuǎn)程多會(huì)話調(diào)試的相關(guān)資料,文中通過示例代碼以及圖片介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧。2017-09-09