perms() public static méthode

Returns the file permissions as a nice string, like -rw-r--r-- or false if the file is not found.
public static perms ( string $file, integer $perms = null ) : string
$file string The name of the file to get permissions form
$perms integer Numerical value of permissions to display as text.
Résultat string
Exemple #1
0
 public function testWritable()
 {
     if (Sys::isWin()) {
         //skip('This functionality is not working on Windows.');
         return false;
     }
     if (Sys::isRoot()) {
         skip('These tests don\'t work when run as root');
     }
     isFalse(FS::writable('/no/such/file'));
     // Create a file to test with
     $dirname = dirname(__FILE__);
     $file = $dirname . '/test7';
     touch($file);
     chmod($file, 0644);
     // The file is owned by us so it should be writable
     isTrue(is_writable($file));
     is('-rw-r--r--', FS::perms($file));
     // Toggle writable bit off for us
     FS::writable($file, false);
     clearstatcache();
     isFalse(is_writable($file));
     is('-r--r--r--', FS::perms($file));
     // Toggle writable bit back on for us
     FS::writable($file, true);
     clearstatcache();
     isTrue(is_writable($file));
     is('-rw-r--r--', FS::perms($file));
     unlink($file);
 }