Home>Article>Backend Development> How to batch modify file names in php

How to batch modify file names in php

coldplay.xixi
coldplay.xixi Original
2020-08-28 15:23:22 2777browse

php批量修改文件名的方法:首先打开编辑器;然后使用函数item替换函数名,代码为【if(!in_array($item,['.','..']))$arr = explode(".", $item);】。

How to batch modify file names in php

相关学习推荐:php图文教程

php批量修改文件名的方法:

需求描述:

某个文件夹下有100个文件,现在需要将这个100个文件的文件名后添加字符串Abc(后缀名保持不变)。

代码实现:

方法一


      

方法二


      

方法二使用了copy函数,更加简便。

相关学习推荐:php编程(视频)

The above is the detailed content of How to batch modify file names in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn