PHP文件操作

Original 2019-05-06 13:45:39 271
abstract:"; echo filesize($fileName),"
"; echo filesize($fileName),"
"; echo '文件创建时间'.date('Y-m-d H:i:s',filectime($fileName))."
" ; echo '文件修改时间'.date('Y-m-d H:i:s',filemtime($fileName))."
" ; echo '文件最后访问时间'.date('Y-m-d H:i:s',fileatime($fileName))."
" ; echo '
'; //文件路劲相关函数 $fileName = "2.php"; var_dump(pathinfo($fileName)); echo '
'; echo '返回文件中的目录部分'.pathinfo($fileName,PATHINFO_DIRNAME); echo '
'; echo dirname($fileName); echo '
'; echo '返回文件名'.pathinfo($fileName,PATHINFO_BASENAME); echo '
'; echo basename($fileName); echo '
'; //文件操作相关函数 var_dump(touch('text1.txt')); if(file_exists('text1.txt')){ if(unlink('text1.txt')){ echo "删除成功"; }else{ echo "删除失败"; } }else{ echo "文件不存在"; }; var_dump(rename('text1.txt','text2.txt')); var_dump(copy('text2.txt','txt.txt')); var_dump(copy('//m.sbmmt.com','111.html')); echo "
"; //文件内容相关函数 var_dump(fopen('1.php','rb')); echo fread(fopen('1.php','r'),filesize('1.php')); echo '当前指针所在的位置:'.ftell(fopen('1.php','rb')); fclose(fopen('text1.txt','rb')); echo fread(fopen('text1.txt','r'),filesize('text1.txt')); ?>


Correcting teacher:查无此人Correction time:2019-05-07 09:44:59
Teacher's summary:完成的不错,文件处理一般用在表格导出,导入,图片。 继续加油。

Release Notes

Popular Entries