php专区

 首页 > php专区 > PHP高级 > 文件上传 > php检查文件是否可读和可写 - php文件操作

php检查文件是否可读和可写 - php文件操作

分享到:
【字体:
导读:
          is_readable() 函数判断指定文件名是否可读。?php $file=test txt; if(is_readable($file)){ echo($fileisreadable); }else{ ec...

php检查文件是否可读和可写

is_readable() 函数判断指定文件名是否可读。

  1.     $file = "test.txt";  
  2.     if(is_readable($file)) {  
  3.         echo ("$file is readable");  
  4.     } else {  
  5.         echo ("$file is not readable");  
  6.     }  
  7. ?> 

is_writeable() 函数判断指定的文件是否可写。

该函数是 is_writable() 函数的别名。

  1.     $file = "test.txt";  
  2.     if(is_writeable($file)) { echo ("$file is writeable");  
  3.     } else { echo ("$file is not writeable");  
  4.     }  
  5.  
  6. ?> 
分享到:
php filemtime定时生成文件代码 - php文...
php filemtime定时生成文件代码 filemtime() 函数返回文件内容上次的修改时间,若成功,则时间以 Unix 时间戳的方式返回,若失败,则返回 false。 语法:filemtime(filename) $path = "a.txt";  if( file_exists( $path ) ){       $filetimes = filemtime($path);  ...
curl获取远程文件内容 - php文件操作
curl获取远程文件内容 /**        获取远程文件内容        @param $url 文件http地址    */    function fopen_url($url)    {        if (function_exists('file_get_contents')) {            $file_content =...
  •         php迷,一个php技术的分享社区,专属您自己的技术摘抄本、收藏夹。
  • 在这里……