《PHP應用:PHP Smarty模版簡單使用方法》要點:
本文介紹了PHP應用:PHP Smarty模版簡單使用方法,希望對您有用。如果有疑問,可以聯系我們。
本文實例講述了PHP Smarty模版簡單使用辦法.分享給大家供大家參考,具體如下:PHP學習
Index.php:PHP學習
require('../libs/Smarty.class.php'); $smarty = new Smarty; // 添加自定義調節器 $smarty->registerPlugin("modifier", "e", "htmlspecialchars"); $smarty->registerPlugin("modifier", "trim", "trim"); //$smarty->force_compile = true; $smarty->debugging = true; $smarty->caching = true; $smarty->cache_lifetime = 120; //定義標識符 $smarty->left_delimiter = '{ '; $smarty->right_delimiter = ' }'; //綁定變量 $smarty->assign("test_html", "<a>haha</a>"); $smarty->display('index.tpl');
index.tpl:PHP學習
<h1>{ $test_html|e }</h1>
跋文:如何讓VS支持tpl擴展名的HTML編輯PHP學習
在菜單[工具>選項]中設置,如下圖:PHP學習
PHP學習
更多關于PHP相關內容感興趣的讀者可查看本站專題:《PHP網絡編程技巧總結》、《PHP基本語法入門教程》、《php操作office文檔技巧總結(包括word,excel,access,ppt)》、《php日期與時間用法總結》、《php面向對象程序設計入門教程》、《php字符串(string)用法總結》、《php+mysql數據庫操作入門教程》及《php常見數據庫操作技巧匯總》PHP學習
希望本文所述對大家PHP程序設計有所贊助.PHP學習
歡迎參與《PHP應用:PHP Smarty模版簡單使用方法》討論,分享您的想法,維易PHP學院為您提供專業教程。
轉載請注明本頁網址:
http://www.snjht.com/jiaocheng/7006.html