时间:2021-07-01 10:21:17 帮助过:4人阅读
[personal information]
 name = "abc"
 quest = tes
 favorite color = csd
 [status]
 Gender = 男
 Country = 中华人民共和国
   那么
      $file_array = parse_ini_file("my.ini");
     print_r($file_array);
 ?>
  这样的输出是没分段的,以array { [name]=>abc....}输出
 要按部分输出INI文件的话,设置第二个参数为ini
          $file_array = parse_ini_file("my.ini", true);
     print_r($file_array);
 ?>
 
 2) 统计某个目录的剩余空间
         $drive = "c:/windows";
     echo round((disk_free_space($drive) / 1048576), 2)."K字节";
 ?>
 3) 显示磁盘的逻辑容量
          $systempartitions = array("c:", "d:","e:");
     foreach ($systempartitions as $partition) {
         $totalSpace = disk_total_space($partition) / 1048576;
         $usedSpace = $totalSpace - disk_free_space($partition) / 1048576;
         echo "分区: $partition (容量: $totalSpace MB. 已使用: $usedSpace MB.)
";
     }
 ?>
 
 4) 计算文件大小 filesize()
        $file = "php_development.pdf";
     $bytes = filesize("$file");
     echo "文件名 ".basename($file)." 大小为 $bytes字节, 或 ".round($bytes / 1024, 2)." K字节.";
 ?>
 5) 取得文件的建立,最后访问和更新时间
         $file = "demo.gif";
     echo "文件最后一次访问时间:".date("Y-m-d g:i:sa",  fileatime($file));
     echo "
文件建立时间: ".date("Y-m-d g:i:sa",  filectime($file));
     echo "
文件最后一次更新: ".date("y-m-d g:i:sa",  filemtime($file));
 ?>