小白教程
所有教程
关于
Search
108.162.216.222
108.162.216.222
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Func filesystem parse ini file”的源代码
本页内容
上一节:
Func_filesystem_move_uploaded_file
下一节:
Func_filesystem_pathinfo
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:parse_ini_file()}}[[Category:PHP Filesystem 文件系统参考手册|58]] = PHP parse_ini_file() 函数 = [[Category:PHP Filesystem 文件系统参考手册]] == 定义和用法 == parse_ini_file() 函数解析一个配置文件(ini 文件),并以数组的形式返回其中的设置。 == 语法 == <pre> parse_ini_file(file,process_sections) </pre> {| class="table table-striped table-hover" ! 参数 ! 描述 |- | file | 必需。规定要检查的 ini 文件。 |- | process_sections | 可选。如果设置为 TRUE,则返回一个多维数组,包括了配置文件中每一节的名称和设置。默认是 FALSE。 |} == 提示和注释 == '''提示:'''本函数可以用来读取您自己的应用程序的配置文件,与 php.ini 文件没有关系。 '''注释:'''有些保留字不能作为 ini 文件中的键名,包括:null、yes、no、true 和 false。字符 {}|&~![()" 也不能用在键名的任何地方。 == 实例 1 == "test.ini" 的内容: <pre> [names] me = Robert you = Peter [urls] first = "http://www.example.com" second = "https://www.xiaobai.wang" </pre> PHP 代码: <?php print_r(parse_ini_file("test.ini")); ?> 上面的代码将输出: Array ( [me] => Robert [you] => Peter [first] => http://www.example.com [second] => https://www.xiaobai.wang ) == 实例 2 == "test.ini" 的内容: <pre> [names] me = Robert you = Peter [urls] first = "http://www.example.com" second = "http://www.w3cschool.cc" </pre> PHP 代码(process_sections 设置为 true): <sample title="" desc="" lang="php" hererun="1"> <?php print_r(parse_ini_file("test.ini",true)); ?> </sample> 上面的代码将输出: <pre> Array ( [names] => Array ( [me] => Robert [you] => Peter ) [urls] => Array ( [first] => http://www.example.com [second] => http://www.w3cschool.cc ) ) </pre> [[Category:PHP Filesystem 文件系统参考手册]]
返回至“
Func filesystem parse ini file
”。
上一节:
Func_filesystem_move_uploaded_file
下一节:
Func_filesystem_pathinfo