How to modify the image name in php: first specify the file path through the "glob("20190505/*.jpg");" method; then use a foreach loop to traverse to obtain the image suffix name; finally modify the image name through the rename function That’s it.
Recommended: "PHP Video Tutorial"
php batch modification of image names
//指定文件路径 $arr = glob("20190505/*.jpg"); //循环遍历 foreach($arr as $file) { //获取图片后缀名 $ext = pathinfo($file,PATHINFO_EXTENSION); //重命名 rename($file,__DIR__.'/photo/'.$name); } die();
The above is the detailed content of How to modify image name in php. For more information, please follow other related articles on the PHP Chinese website!