随笔分类 - php文件操作
摘要:文件信息函数 目录相关函数 目录类相关方法 DirectoryIterator类封装了很多与目录相关的方法 文件时间戳解惑 touch()函数修改文件的更新时间 fileatime()函数返回文件因为读或写被打开的最后时间 filemtime()函数返回文件内容被修改的最后时间 filectime(
阅读全文
摘要:创建一个文件夹:public function index(){ if (!is_dir('d:/hl')) { mkdir('d:/hl'); }else{ echo '文件夹已经存在'; } }创建层级文...
阅读全文
摘要:代码:public function index(){ $path='G:/相片/2014.9.8深圳莲花山/IMG_1282.JPG'; $path=iconv('utf-8','gb2312',$path);//转码,使汉子路径能解析 copy($pat...
阅读全文
摘要:第一种方法:public function index(){ $path='./Public/test.txt'; $fp=fopen($path,'a+'); fwrite($fp,"\r\n你好"); fclose($fp); }第二...
阅读全文
摘要:第一种方法:public function index(){ if($file=fopen('./Public/test.txt','a+')){ $file_info=fread($file,filesize('./Public/test.txt')); ...
阅读全文
摘要:文件打开操作可以取到文件大小,创建、修改、访问等信息,代码如下:public function index(){ if($file=fopen('./Public/test.txt','r')){ $file_info=fstat($file); ...
阅读全文