Smarty安裝配置方法
更新時間:2008年04月10日 23:14:08 作者:
下載最新的Smarty最簡單的測試?yán)?,以測試smarty是否安裝成功
下載最新的Smarty:http://smarty.php.net/
當(dāng)前最新版本:2.6.18
解壓后將目錄中的libs目錄重命名為smarty,復(fù)制到你的網(wǎng)站目錄,同時在網(wǎng)站根目錄下建立templates和templates_c兩個目錄
建立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安裝成功了!
當(dāng)前最新版本:2.6.18
解壓后將目錄中的libs目錄重命名為smarty,復(fù)制到你的網(wǎng)站目錄,同時在網(wǎng)站根目錄下建立templates和templates_c兩個目錄
建立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安裝成功了!
相關(guān)文章
解析PHP將對象轉(zhuǎn)換成數(shù)組的方法(兼容多維數(shù)組類型)
本篇文章是對PHP將對象轉(zhuǎn)換成數(shù)組的方法(兼容多維數(shù)組類型)進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下2013-06-06
php5.4以上版本GBK編碼下htmlspecialchars輸出為空問題解決方法匯總
這篇文章主要介紹了php5.4以上版本GBK編碼下htmlspecialchars輸出為空問題解決方法匯總,本文給出多種解決這個問題的方法,需要的朋友可以參考下2015-04-04
仿AS3實現(xiàn)PHP 事件機制實現(xiàn)代碼
仿AS3實現(xiàn)PHP 事件機制實現(xiàn)代碼,需要的朋友可以參考下。2011-01-01

