php批量修改圖片名稱
- 2019 年 10 月 5 日
- 筆記
//指定文件路徑 $arr = glob("20190505/*.jpg"); //循環遍歷 foreach($arr as $file) { //獲取圖片後綴名 $ext = pathinfo($file,PATHINFO_EXTENSION); //重命名 rename($file,__DIR__.'/photo/'.$name); } die();
來源網路
//指定文件路徑 $arr = glob("20190505/*.jpg"); //循環遍歷 foreach($arr as $file) { //獲取圖片後綴名 $ext = pathinfo($file,PATHINFO_EXTENSION); //重命名 rename($file,__DIR__.'/photo/'.$name); } die();
來源網路