這篇文章主要為大家展示了“PHP中Smarty模版怎么用”,內(nèi)容簡(jiǎn)而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“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; //定義標(biāo)識(shí)符 $smarty->left_delimiter = '{ '; $smarty->right_delimiter = ' }'; //綁定變量 $smarty->assign("test_html", "<a>haha</a>"); $smarty->display('index.tpl');
index.tpl:
<h2>{ $test_html|e }</h2>
后記:如何讓VS支持tpl擴(kuò)展名的HTML編輯
在菜單[工具>選項(xiàng)]中設(shè)置,如下圖:
以上是“PHP中Smarty模版怎么用”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
名稱(chēng)欄目:PHP中Smarty模版怎么用-創(chuàng)新互聯(lián)
轉(zhuǎn)載來(lái)源:http://chinadenli.net/article46/epshg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供關(guān)鍵詞優(yōu)化、網(wǎng)站建設(shè)、微信公眾號(hào)、自適應(yīng)網(wǎng)站、App設(shè)計(jì)、軟件開(kāi)發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容