Smarty模板簡單配置與使用方法示例,smarty模板示例_PHP教程
Jul 12, 2016 am 08:50 AMSmarty模板簡單配置與使用方法示例,smarty模板示例
本文實例講述了Smarty模板簡單配置與使用方法。分享給大家供大家參考,具體如下:
在Smarty目錄中建立templates,templates_c,configs,cache目錄。以便Smarty進行編譯和緩存。
建立smarty_inc.php文件對smarty進行配置如下:
<?php include_once("./smarty/Smarty.class.php"); //包含smarty類文件 $smarty = new Smarty(); //建立smarty實例對象$smarty $smarty->caching=false; //開發(fā)是不建議開啟緩存 $smarty->template_dir="./templates"; //設置模板目錄 $smarty->compile_dir="./templates_c"; //設置編譯目錄 $smarty->cache_dir="./cache"; //緩存文件夾 $smarty->cache_lifetime=60; $smarty->left_delimiter = "<{"; //左定界符 $smarty->right_delimiter = "}>"; //右定界符 ?>
行測試,在根目錄下建立index.php文件:
<?php include("smarty_inc.php"); $val= array("丁慶","董丹鳳","情侶"); $smarty->assign("name",$val); $smarty->display("index.html"); ?>
在templates下建立index.html模板:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset="utf-8"> <title>測試頁面</title> </head> <body> <{foreach from=$name item=x}> 數組內容:<{$x}> <br/> <{/foreach}> </body> </html>
好了,大功告成,就是這么簡單。
更多關于Smarty相關內容可查看本站專題:《smarty模板入門基礎教程》、《PHP模板技術總結》、《PHP基于pdo操作數據庫技巧總結》、《PHP運算與運算符用法總結》、《PHP網絡編程技巧總結》、《PHP基本語法入門教程》、《php面向對象程序設計入門教程》、《php字符串(string)用法總結》、《php+mysql數據庫操作入門教程》及《php常見數據庫操作技巧匯總》
希望本文所述對大家基于smarty模板的PHP程序設計有所幫助。

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

Win11?? ?? ??? ???? ?? ?? ??? ?? ?? ?????? ?? ???? ???? ????, ??, ??? ? ?? ???? ??? ?? ??? ? ????. Win11 ?????? ?? ??? ???? ?? ?? ?????. ?? ??? ?????. 1??: "??" ??????? ???. ?? Win11 ???? "??" ??? ??? ?? ?? ???? "??" ??????? ?????. "Win+I" ???? ???? "??"? ? ?? ????. 2??: "???"? ?????. ?? ?? ?? ??? ?????. ??? ?? ???? ????? "???" ??? ?????. 3??: "??"? ?????. "???" ?? ???? ?? ?? ??? ?????. ?????

??: Linux ????? GDM? ?? ?? ? ?? ?? Linux ?? ???? GDM(GNOMEDisplayManager)? ??? ??? ?????(GUI) ??? ? ??? ?? ??? ???? ??? ???? ???? ????? ??????. ? ????? GDM? ?? ??? ?? ??? ???? ???? ?? ??? ?????. 1. GDM? ?? ?? GDM? GNOME ???? ??? ????? ????? X ??? ???? ????? ??? ?????? ?????.

PyCharm? ??? ?? ?? ??(IDE)??, PyTorch? ? ?? ???? ?? ?? ?? ?? ????????. ????? ??? ???? PyCharm? PyTorch? ??? ???? ?? ???? ?? ??? ?? ???? ? ????. ? ????? PyCharm?? PyTorch? ?? ? ???? ??? ??? ???? ??? ? ? ??? ??? ??? ? ? ??? ? ??? ?? ?? ??? ?????. 1??: PyCharm ? Python ??

Linux Bashrc ??: ??, ?? ? ??? Linux ????? Bashrc(BourneAgainShellruncommands)? ??? ?? ? ???? ???? ??? ??? ??? ??? ?? ??? ?? ?????. Bashrc ??? ????? ???? ? ????? ??? ??? ?????. ?? ??? ???? ?? Bashshell ??? ??? ???? ????. 1. Bashrc ?? ?? ??

??: Linux ????? FTPS? ???? ???? ???? ?? ?? ??? ?????. Linux ????? FTPS? FTP? ???? ??? ???? TLS/SSL ????? ?? ?????? ??? ?????. ??? ??? ??. ? ????? Linux ????? FTPS? ?? ? ???? ??? ???? ???? ?? ??? ?????. 1??: vsftpd ?? ???? ?? ?? ??? ???? vsftpd? ?????. sudo

MyBatisGenerator? MyBatis?? ????? ???? ?? ?? ???, ???? ?????? ??? ??? ?? JavaBeans, Mapper ????? ? XML ?? ??? ??? ??? ? ??? ?????. ?? ??? ?? MyBatisGenerator? ???? ???? ?? ???? ??? ?????. ? ?? ?? ????? ???? ???? MyBatisGenerator? ??? ?? ??? ????.

??: ??? Python ????? ?????? ??? ?? ??? ?? ?? ?? ??? ??, ?? ?? ? ?? ???? Python ??? ?? ???? ?? ?? ? ?? ???? ???? ??? Python ????? ??? ?? ??? ???? ????. ??????. ??? ??? ??? ? ?? ?? ?? ??? Python ?????? ??? ?? ????? ????? ???? ?? ??? ????? ???. ? ????? ??? Python ????? ??????? ???? ??? ???? ?? ??? ?????.

win11 ???? ???? ?? ?? ??? ??? ???? ? ?? ???, ?? ????? win11 ??? ??? ??? ???? ??? ?? ????. ??? ??? ?? ?????. ???? ???? ??? ??? ?? ?? ??? ?? ??? ? ? ????. ? ?????? win11 ??? ?? ??? ?? ??? ????? ?? ?? ?????. win11 ??? ?? ??? ?? ?? ?? 1: 1. ??? ???? ??? ??? ???. 3. ? ????? ??? ?? ??? ? ? ????. 2. ?? ???? ??? systeminfo? ???? Enter? ?? ??? ??? ?????.
