欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP Smarty模版簡單使用方法

 更新時間:2016年03月30日 11:57:35   作者:xiao張  
這篇文章主要介紹了PHP Smarty模版簡單使用方法,結(jié)合實例形式分析了PHP調(diào)用Smarty模板的配置,變量設置及使用方法,需要的朋友可以參考下

本文實例講述了PHP Smarty模版簡單使用方法。分享給大家供大家參考,具體如下:

Index.php:

require('../libs/Smarty.class.php');
$smarty = new Smarty;
// 添加自定義調(diào)節(jié)器
$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:

<h1>{ $test_html|e }</h1>

后記:如何讓VS支持tpl擴展名的HTML編輯

在菜單[工具>選項]中設置,如下圖:

更多關于PHP相關內(nèi)容感興趣的讀者可查看本站專題:《PHP網(wǎng)絡編程技巧總結(jié)》、《PHP基本語法入門教程》、《php操作office文檔技巧總結(jié)(包括word,excel,access,ppt)》、《php日期與時間用法總結(jié)》、《php面向?qū)ο蟪绦蛟O計入門教程》、《php字符串(string)用法總結(jié)》、《php+mysql數(shù)據(jù)庫操作入門教程》及《php常見數(shù)據(jù)庫操作技巧匯總

希望本文所述對大家PHP程序設計有所幫助。

相關文章

最新評論