search
Homephp教程php手册smarty内置函数config_load用法实例,smartyconfig_load

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

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.