Nested arrays in ini file

前端 未结 4 664
小鲜肉
小鲜肉 2021-01-11 13:36

I am trying to have a nested array structure inside an ini settings file. The structure i have is:

stuct1[123][a] = \"1\"
stuct1[123][b] = \"2\"
stuct1[123][         


        
4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-11 14:36

    Here is another way to group values in the ini:

    my.ini:

    [singles] 
    test = a test 
    test2 = another test 
    test3 = this is a test too
    
    [multiples] 
    tests[] = a test 
    tests[] = another 
    test tests[] = this is a test too
    

    my.php:

    The same as:

    
    

    This works with the bool set to true also, can be useful with loops. Works with the bool set to true as well.

    http://php.net/manual/en/function.parse-ini-file.php

    Posted by david dot dyess at gmail dot com 4 years ago

提交回复
热议问题