Home >Backend Development >PHP Tutorial > 如何把数组的key索引转化成数字索引
怎么把数组的key索引转化成数字索引?
比如我从ini文件中读取的信息是个一维数组:
这是我的ini文件
[web]
host = localhost
connuser = root
connpwd = root
conndb = myoffice
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> //读取文件 function ReadConfig($filename) { if(file_exists($filename) == false) { //echo "<br>文件".$filename."不存在!<br>"; return NULL; } return parse_ini_file($filename,true); } //测试 $Setting = array(); $res = array(); $Setting = ReadConfig("webconfig.ini"); print_r($Setting);
Array ( [web] => Array ( [host] => localhost [connuser] => root [connpwd] => root [conndb] => myoffice ) ) <div class="clear"> </div>