我想知道有没有办法(在.ini文件中)实现一些东西,当被parse_ini_file() (php中)解析时,它将创建一个多维数组,而不仅仅是一个关联数组?
我一直在找,但一无所获,所以我想知道这里有没有人知道这样的事情是否允许。
示例:
file.ini (半子码):
input = input1 = ('Hello world this is test #1')
input = input2 = ('Hello world this is test #2')code.php:
$array = parse_ini_file("file.ini", true);
print_r($array);预期输出:
Array
(
[input] => Array
(
[input1] => Hello world this is test #1
[input2] => Hello world this is test #2
)
)发布于 2021-07-08 06:19:13
似乎我在想出一个更好的方式来表达我的问题之后,找到了我自己的答案。
.ini文件可以包含用括号([])括起来的部分,例如:
[input]
input1 = ('Hello world this is test #1');
input2 = ('Hello world this is test #2');这正是我所寻找的部分(在解析时)将其转换为多维数组:
Array
(
[input] => Array
(
[input1] => Hello world this is test #1
[input2] => Hello world this is test #2
)
)当然,在发布这个问题之前,我应该等待更多的时间和更多的研究,但我会把这个问题留给其他可能和我最初有相同问题的人。
https://stackoverflow.com/questions/68293288
复制相似问题