posix_eaccess
Description
The posix_eaccess of POSIX for PHP determines the accessibility of a file.
Syntax
posix_eaccess( string $filename, int $flags = 0 ): bool
Parameters
filename
The name of the file to be tested.
flags
A mask consisting of one or more of the following:
Value | Constant | Description |
---|---|---|
0 | POSIX_F_OK | The file exists. |
1 | POSIX_X_OK | The file exists and has execute permissions. |
2 | POSIX_W_OK | The file exists and has write permissions. |
4 | POSIX_R_OK | The file exists and has read permissions. |
Return
Returns true on success or false on failure.
Examples
1 · filename
<? $filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt'; $return = posix_eaccess($filename); var_export($return);
true
2 · flags · POSIX_F_OK
<? $filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt'; $flags = POSIX_F_OK; $return = posix_eaccess($filename, $flags); var_export($return);
true
3 · flags · POSIX_X_OK
<? $filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt'; $flags = POSIX_X_OK; $return = posix_eaccess($filename, $flags); var_export($return);
false
4 · flags · POSIX_W_OK
<? $filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt'; $flags = POSIX_W_OK; $return = posix_eaccess($filename, $flags); var_export($return);
true
5 · flags · POSIX_R_OK
<? $filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/txt/1.txt'; $flags = POSIX_R_OK; $return = posix_eaccess($filename, $flags); var_export($return);
true
Links
POSIX
- posix_access
- posix_ctermid
- posix_errno
- posix_fpathconf
- posix_get_last_error
- posix_getcwd
- posix_getegid
- posix_geteuid
- posix_getgid
- posix_getgrgid
- posix_getgrnam
- posix_getgroups
- posix_getlogin
- posix_getpgid
- posix_getpgrp
- posix_getpid
- posix_getppid
- posix_getpwnam
- posix_getpwuid
- posix_getrlimit
- posix_getsid
- posix_getuid
- posix_initgroups
- posix_isatty
- posix_kill
- posix_mkfifo
- posix_mknod
- posix_pathconf
- posix_setegid
- posix_seteuid
- posix_setgid
- posix_setpgid
- posix_setrlimit
- posix_setsid
- posix_setuid
- posix_strerror
- posix_sysconf
- posix_times
- posix_ttyname
- posix_uname