zoukankan      html  css  js  c++  java
  • SystemFile

    header('Content-Type:text/html; charset = utf-8');

    1.

    echo "<pre/>";
    echo __FILE__."<br/>";   //当前文件
    echo basename(__FILE__,'.php');  // 获取文件的文件名(去掉.php后缀)

    echo getcwd(); // 获取当前文件路劲

    2.echo disk_free_space(getcwd())/1024;     //查看当前文件所在磁盘的剩余空间

    echo "<br/>";
    echo disk_total_space(getcwd())/1024;    //查看当前文件所在磁盘的总空间

    3.

    $fp = @fopen(__FILE__, 'r+');  // 以读追加的方式打开当前文件 

    /*获取当前文件句柄内的字符串*/
    if(!empty($fp))
    {
    while(false !== ($char = fgets($fp)))           
    echo "$char ";
    }

    4.

    $string = file_get_contents(__FILE__,FILE_USE_INCLUDE_PATH);   //将整个文件读入字符串   **file_get_contents() 函数是用来将文件的内容读入到一个字符串中的首选方法。如果操作系统支持还会使用内存映射技术来增强性能。 

    echo $string;*/

    5.

    $file_time = fileatime(__FILE__);     //获得文件的上次访问时间
    echo date('Y-m-d H:i:s', $file_time);
    echo '<BR/>';
    echo date('Y-m-d H:i:s', filectime(__FILE__));
    echo '<br/>';

    //文件的所属性息
    echo filegroup(__FILE__).'<br/>'.fileinode(__FILE__).'<BR/>'.date('Y-m-d H:i:s', filemtime(__FILE__));
    echo '<BR/>'.fileowner(__FILE__).'<BR/>'.fileperms(__FILE__).'<BR/>'.filetype(__FILE__);

    6.

    $fp = @fopen(__FILE__, 'r');
    $fstat = fstat($fp);     //获取已打开的文件句柄的文件信息 
    print_r($fstat);
    echo '<br/>'.ftell($fp);
    var_dump(is_executable(__FILE__));    //文件是否可执行 

    7.var_dump(is_readable(__FILE__), is_writeable(__FILE__));   //文件是否可读,可写;

    8.$path_ini = php_ini_loaded_file();      // 其实就是Apache 下的 /bin/php.ini 文件

  • 相关阅读:
    HDU 1069 Monkey and Banana
    HDU 1029 Ignatius and the Princess IV
    HDU 1024 Max Sum Plus Plus
    Gym100923H Por Costel and the Match
    Codeforces 682C Alyona and the Tree
    Codeforces 449B Jzzhu and Cities
    Codeforces (ccpc-wannafly camp day2) L. Por Costel and the Semipalindromes
    Codeforces 598D (ccpc-wannafly camp day1) Igor In the Museum
    Codeforces 1167c(ccpc wannafly camp day1) News Distribution 并查集模板
    快乐数问题
  • 原文地址:https://www.cnblogs.com/da-guang/p/4974402.html
Copyright © 2011-2022 走看看