欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php文件操作函数有哪些?

程序员文章站 2022-04-27 21:04:27
...
  1. /*
  2. * 1、获取路径的文件名
  3. * string basename(string path[,string suffix])
  4. * 2、获取路径的目录
  5. * string dirname(string path)
  6. * 3、了解更多的路径信息
  7. * array pathinfo(string path)
  8. * 4、确定绝对路径
  9. * string realpath(string path)
  10. * 5、确定文件的大小
  11. * int filesize(string filename)
  12. * 6、计算磁盘的可用空间
  13. * float disk_free_space(string directory)
  14. * 7、计算磁盘的总容量
  15. * float disk_total_space(string directory)
  16. * 8、确定文件的最后访问时间
  17. * int fileatime(string filename)
  18. * 9、确定文件的最后改变时间
  19. * int filectime(string filename)
  20. * 10、确定文件的最后修改时间
  21. * int filemtime(string filename)
  22. * 11、识别文件末尾字符
  23. * int feof(string resource)
  24. * 12、打开和关闭文件
  25. * resource fopen(string resource,string mode[,int use_include_path[,resource zountext]])
  26. * boolean fclose(resource filehandle)
  27. * 13、将文件读入数组
  28. * array file9string filename[,int user_inlucde_path[,resource context]])
  29. * 14、将文件内容读入字符串变量
  30. * string file_get_contents(string filename[,int use_inlude_path[resource context]])
  31. * 15、将CSV文件读入数组
  32. * array fgetcsv(resource handle[,int length[,string delimiter[,string enclosure]]])
  33. * 16、读取指定数目的字符
  34. * string fgets(resource handle[,int length])
  35. * 17、从输入中剔除标记,清除所有HTML和PHP标记
  36. * string fgetss(resourcce handle,int length[,string allowable_tags])
  37. * 18、以一次读取一个字符的方式读取文件
  38. * string fgetc(resource handle)
  39. * 19、忽略换行符
  40. * string freed(resource handle,int length)
  41. * 20、读取整个文件
  42. * int readfile(string filename[,int use_include_path])
  43. * 21、根据预定义的格式读取文件
  44. * mixed fscanf(resource handle,string format[,string var1])
  45. * 22、将字符串写入文件
  46. * int fwrite(resource handle,string string[,int length])
  47. * 23、移动文件指针
  48. * int fseek(resource handle,int offset[,int whence])
  49. *
  50. * 1、打开目录句柄
  51. * resource opendir(string path)
  52. * 2、关闭目录句柄
  53. * void closedir(resource directory_handle)
  54. * 3、解析目录内容
  55. * string readdir(resource directory_handle)
  56. * 4、将目录读入数组
  57. * array scandir(string directory[,int sorting_order[,resource context]])
  58. *
  59. *
  60. * 1、删除目录
  61. * int rmdir(string dirname)
  62. * 2、重命名文件
  63. * boolean rename(string olename,string newname)
  64. * 3、触摸文件
  65. * int touch(sting filename[,int time[,int atime]])
  66. */
复制代码