php smarty安装,smarty安装(PHP)
PHP之smarty簡單安裝配置介紹:
1 首先,下載smarty-2.6.28;
2 然后,安裝;
(1)解壓文件后,復制libs文件到網站根目錄,改名為smarty;
(2)在根目錄新建四個文件夾:templates,templates_c,configs,cache;
3 最后,測試;
(1)建個php文件:test.php
include_once('smarty/Smarty.class.php');
include_once('smarty/Config_File.class.php');
include_once('smarty/Smarty_Compiler.class.php');
$smarty = new Smarty;
$smarty->template_dir = 'templates/'; //模板存放目錄
$smarty->compile_dir = 'templates_c/'; //編譯目錄
$smarty -> left_delimiter = "{{"; //左定界符
$smarty -> right_delimiter = "}}"; //右定界符
$smarty -> assign('name','Hello World!');
$smarty->assign('title','welcome to SDU');
$smarty -> display('index.tpl');
?>
(2)在templates下,建個tpl文件:index.tpl
{{$title}}(3)運行test.php, 配置成功。
總結
以上是生活随笔為你收集整理的php smarty安装,smarty安装(PHP)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux firefox 解雇ie,F
- 下一篇: 利用FbinstTool+大白菜u盘工具