config_load関数

config_load 関数

使用法:

設定ファイルには複数の部分が含まれる場合があります。追加の属性セクションを使用して、どの部分から変数を取得するかを指定できます。同じものであり、互いに何の関係もありません。

#例:

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

#セクション=="person" の場合、実行結果は次のようになります:



微信图片_20180313093218.png

学び続ける
||
<?php echo "config_load函数";
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!