zoukankan      html  css  js  c++  java
  • 8.2、磁盘、目录和文件计算

     
     PHP Code By http://t.qq.com/tony-src
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    <?php
        
        /**
         * 确定文件的大小  filesize()
         */

        $file = 
    'C:\appserv\www\HelloPHP\index.php' ;
        
    echo round(filesize($file)/1024,2).'KB'.'<br>';

        
    /**
         * 计算磁盘的可用空间        disk_free_space()
         */

        $driver = 
    'C:';
        
    echo round(disk_free_space($driver)/1024/1024/1024,2).'GB'.'<br>';
        
        
    /**
         * 计算磁盘的总容量 disk_total_space()
         */

        
    echo round(disk_total_space($driver)/1024/1024/1024,2).'GB'.'<br>';
        
        
    /**
         * 确定文件的最后访问时间      fileatime(),最后访问时间
         */

        date_default_timezone_set(
    'Asia/Shanghai');
        
    echo date('Y-m-d H:i:s',fileatime($file)).'<br>';
        
        
    /**
         * 确定文件的最后改变时间      filectime() ,所有者,权限修改时间
         */

        
    echo date('Y-m-d H:i:s',filectime($file)).'<br>';
        
        
    /**
         * 确定文件的最后修改时间      filemtime(),文件内容修改时间
         */

        
    echo date('Y-m-d H:i:s',filemtime($file).'<br>');
        
    ?>




  • 相关阅读:
    【线段树合并】联通分量计数
    莫队算法
    Ubuntu实用软件安装[转]
    装系统·折腾记
    Qt环境配置 + Qt使用教程
    Google题解
    隐含马尔科夫模型
    Pythonの坑
    C++11并发编程个人小结
    微软2017年预科生计划在线编程笔试
  • 原文地址:https://www.cnblogs.com/tonycody/p/2799916.html
Copyright © 2011-2022 走看看