A brief introduction to PHP Get file attributes Method _php Tutorial

Source: Internet
Author: User

PHP Gets the file attributes last modified time:

 
  
  
  1. < ? PHP
  2. $ file ' test.txt ';

  3. Filemtime ($file));
  4. ?>

Returns a timestamp that says Unix, which is commonly used in caching techniques.

The relevant PHP gets the file attributes of the last accessed time Fileatime (), Filectime () when the permissions of the file, owner, all groups or other inode metadata is updated time, Fileowner () function returns the file owner

$owner = Posix_getpwuid (Fileowner ($file));

(Non-Window System), Ileperms () Gets the file permissions,

 
  
  
  1. < ? PHP
  2. $ file ' dirlist.php ';
  3. $ perms substr(sprintf
    ('%o ', Fileperms ($file))
    ,-4);
  4. Echo $perms;
  5. ?>

FileSize () returns the number of bytes in the file size:

 
  
  
  1. < ? PHP
  2. Output similar to: Somefile.txt:
    1024x768 bytes
  3. $ filename ' somefile.txt ';

  4. . FileSize ($filename). ' bytes ';
  5. ?>

PHP gets all the information about the properties of a file with a function stat () function that returns an array:

 
  
  
  1. < ? PHP
  2. $ file ' dirlist.php ';
  3. $ perms stat($file);
  4. Var_dump ($perms);
  5. ?>


http://www.bkjia.com/PHPjc/445971.html www.bkjia.com true http://www.bkjia.com/PHPjc/445971.html techarticle php Gets the file attributes of the last modified time: PHP $ file = ' Test.txt '; Echodate (' R ', Filemtime ($file)); return the Unix timestamp, which is commonly used in caching techniques. Related PHP get ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.