根据这里的链接,我写了一个与底部类似的答案。想知道是否有更通用和更紧凑的方法来编写解决方案?
$multi_d = array();
$read_conf = parse_ini_file($filename);
foreach( $read_conf as $keys => $value)
{
$temp =& $multi_d;
foreach(explode( '.', $keys) as $key)
$temp =& $temp[$key];
$temp = trim( $value);
}