php smarty 配置,php Smarty详细配置
生活随笔
收集整理的這篇文章主要介紹了
php smarty 配置,php Smarty详细配置
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1.在Smarty官網下載 路徑:https://github.com/smarty-php/smarty/releases
2.把下載下來的Smarty解壓出來
3.把解壓出來的Smarty里面的libs復制到你創建的項目下面
4.在Smarty下面創建兩個文件夾:templates存放模板的,和templates_c存放編譯后的文件
5.在index.php里面寫如下代碼:
//創建Smarty對象
require_once ‘./libs/Smarty.class.php‘;
//實例化Smarty對象
$smarty=new Smarty();
//設置變量和值
$smarty->assign("var","hello world");
//應用模板文件
$smarty->display("hello.html");
?>
6.在templates目錄下創建對應的hello.html文件
7.hello.html文件代碼如下:
Insert title here{$var} ? ?//引入變量名
7.在瀏覽器打開index.php你會看到 hello word!
原文:http://www.cnblogs.com/tgmo/p/4720129.html
總結
以上是生活随笔為你收集整理的php smarty 配置,php Smarty详细配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 身神话继续遭受DDOS进攻,也遭受了雷同
- 下一篇: WinRAR 4.01 简体中文版 [0