Smarty安裝配置方法_PHP教程

來源:互聯網
上載者:User
下載最新的Smarty:http://smarty.php.net/
當前最新版本:2.6.18
解壓後將目錄中的libs目錄重新命名為smarty,複製到你的網站目錄,同時在網站根目錄下建立templates和templates_c兩個目錄
建立test.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許可權755

在templates目錄下建立test.html:




{{$test}}


開啟test.php,如果看到OK就說明你的smarty安裝成功了!

http://www.bkjia.com/PHPjc/318884.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/318884.htmlTechArticle下載最新的Smarty:http://smarty.php.net/ 當前最新版本:2.6.18 解壓後將目錄中的libs目錄重新命名為smarty,複製到你的網站目錄,同時在網站根目錄...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.