-
-
$myfile = "./test.txt";
if (is_readable ($myfile)) {
- echo "此文件可读。", "\n";
- } else {
- echo "此文件不可读.", "/n";
- }
-
- if (is_writable ($myfile)) {
- echo "此文件可写。", "/n";
- } else {
- echo "此文件不可写。", "/n";
- }
if (is_executable ($myfile)) {
- echo "此文件可执行!", "\n";
- } else {
- echo "此文件没有可执行权限。", "\n";
- }
- ?>
-
复制代码
附,检测文件的大小,学习filesize的用法。
-
-
$myfile = "./test.txt";
if (file_exists ($myfile)) {
- $checksize=filesize ($myfile);
- echo "$checksize";
- } else {
- echo "文件不存在!";
- }
- ?>
-
复制代码
|