smarty內建函數config_load用法執行個體,smartyconfig_load
本文執行個體講述了smarty內建函數config_load用法。分享給大家供大家參考。具體如下:
{config_load}用於從設定檔中,載入到組態變數。詳細用法如下:
設定檔:foo.conf
說明:[Table] 和 [Customer] 表示段落名稱。
複製代碼 代碼如下:[Table]
pageTitle = "this is mine"
bodyBgColor = "#eee"
tableBorderSize = 3
tableBgColor = "#bbb"
rowBgColor = "#ccc"
[Customer]
pageTitle = "Customer Info"
模板檔案:temp.htm
複製代碼 代碼如下:{config_load file="foo.conf"}
{#pageTitle#}
{#bodyBgColor#}
第一種引入方法:錯誤。如果設定檔中每個段落都有名稱,則必須加上 section="段落名稱",才能載入到變數。
複製代碼 代碼如下:{config_load file="foo.conf" section="Customer"}
{#pageTitle#}
{config_load file="foo.conf" section="Table"}
{#pageTitle#}
第二種載入方法,正確。載入相應的段落,引入相應的變數。
希望本文所述對大家的php程式設計有所協助。
http://www.bkjia.com/PHPjc/946755.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/946755.htmlTechArticlesmarty內建函數config_load用法執行個體,smartyconfig_load 本文執行個體講述了smarty內建函數config_load用法。分享給大家供大家參考。具體如下: {config_lo...