config_load fun...LOGIN

config_load function

config_load function

Usage:

The configuration file may contain multiple parts. At this time, you can use the additional attribute section to specify which part to get the variable from.

Note: The section in the configuration file and the template built-in function section are just named the same and have nothing to do with each other.

#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='这是其他'

Run results:

微信图片_20180313092919.png


##section When =="Person", the running result is:

微信图片_20180313093218.png


#Next Section

<?php echo "config_load函数";
submitReset Code
ChapterCourseware