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程序设计有所帮助。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

Notepad++7.3.1
Easy-to-use and free code editor

Atom editor mac version download
The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.