config_load函数 登录

config_load函数

config_load函数

使用方式:

配置文件有可能包含多个部分,此时可以使用附加属性 section 指定从哪一部分中取得变量.

注意:配置文件中的 section 和模板内建函数 section 只是命名相同,毫不相干。

eg:

test.html:

{config_load file="colors.conf" section="Customer"}
<html>
<title>{#pageTitle#}</title>
<body bgcolor="{#bodyBgColor#}">
<table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
<tr bgcolor="{#rowBgColor#}">
<td>First</td>
<td>Last</td>
<td>Address</td>
</tr>
</table>
</body>
</html>

colors.conf:

#注释
#段落变量
[Customer]
pageTitle='顾客表'
bodyBgColor='#00f'
tableBorderSize='1'
tableBgColor='skyblue'
rowBgColor='red'
tableBgColor='skyblue'
[Person]
pageTitle='所有人表'
bodyBgColor='#eee'
tableBorderSize='1'
tableBgColor='skyblue'
rowBgColor='red'
tableBgColor='skyblue'
[other]
other='这是其他'

运行结果:

微信图片_20180313092919.png


section="Person"时运行结果:

微信图片_20180313093218.png



下一节
<?php echo "config_load函数";
提交 重置代码
章节 评论 笔记 课件
  • 取消 回复 发送
  • 取消 发布笔记 发送