PHP数组显示 phpinfo, ini, extensions等信息
?
来源:http://www.php.net/manual/en/function.phpinfo.php#87463
?
2. get_loaded_extensions? and PHP_VERSION
function parse_ini ( $filepath ) { $ini = file( $filepath ); if ( count( $ini ) == 0 ) { return array(); } $sections = array(); $values = array(); $globals = array(); $i = 0; foreach( $ini as $line ){ $line = trim( $line ); // Comments if ( $line == '' || $line{0} == ';' ) { continue; } // Sections if ( $line{0} == '[' ) { $sections[] = substr( $line, 1, -1 ); $i++; continue; } // Key-value pair list( $key, $value ) = explode( '=', $line, 2 ); $key = trim( $key ); $value = trim( $value ); if ( $i == 0 ) { // Array values if ( substr( $line, -1, 2 ) == '[]' ) { $globals[ $key ][] = $value; } else { $globals[ $key ] = $value; } } else { // Array values if ( substr( $line, -1, 2 ) == '[]' ) { $values[ $i - 1 ][ $key ][] = $value; } else { $values[ $i - 1 ][ $key ] = $value; } } } for( $j=0; $j<$i; $j++ ) { $result[ $sections[ $j ] ] = $values[ $j ]; } return $result + $globals;}//$stores = parse_ini($ini_path);//print_r( $stores );
?
来源:http://php.net/parse_ini_file
?
?
?
?
?