卓越飞翔博客卓越飞翔博客

卓越飞翔 - 您值得收藏的技术分享站
技术文章17272本站已运行3326

在PHP中的parse_ini_string()函数

在PHP中的parse_ini_string()函数

parse_ini_string()函数解析配置字符串。该函数在成功时返回设置的关联数组。在失败时返回FALSE。

语法

'
parse_ini_string(file_path, process_sections)

Parameters

  • file_path − The ini file to be parsed.

  • process_sections − If set to TRUE, you will get a multidimensional array with section names and settings included.

Return

The parse_ini_string() function returns the settings as an associative array on success. It returns FALSE on failure.

Let’s say the content of our “demo.ini” is −

'
[names]
one = Anne
[urls]
host1 = "https://www.example1.com"

Example

'
<?php
   print_r(parse_ini_string("demo.ini"));
?>

输出

'
Array
(
[one] => Anne

[host1] => https://www.example1.com
)
卓越飞翔博客
上一篇: M个范围切换操作后的二进制数组是什么?
下一篇: 返回列表
留言与评论(共有 0 条评论)
   
验证码:
隐藏边栏