Nested arrays in ini file

前端 未结 4 697
小鲜肉
小鲜肉 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:42

    INI files are pretty limited and parse_ini_file is far from perfect. If you have requirements like this, you should better look for some other syntax.

    What about JSON? It's support in PHP comes with almost same comfort:

    $data = json_decode(file_get_contents($filename), TRUE);
    file_put_contents($filename, json_encode($data));
    

提交回复
热议问题