public function actionChangePicsName()
    {
        $dir = "D:/beautifulserver/app/extends/头像";
        $files1 = scandir($dir);
        unset($files1[0]);
        unset($files1[1]);
        $files1 = array_values($files1);
        $n = count($files1);
        for ($i = 0; $i < $n; ++$i){
            $title = sprintf('head%.2s', $i + 1);
            $old_file_name = $dir.'/'.$files1[$i];
            $new_file_name = $dir.'/'.$title.strrchr($files1[$i],'.');
            rename($old_file_name, $new_file_name);
        }
    }

 

相关文章:

  • 2021-05-30
  • 2021-12-14
  • 2021-06-20
  • 2021-12-13
  • 2021-10-16
  • 2022-12-23
  • 2022-01-23
猜你喜欢
  • 2021-05-22
  • 2021-09-12
  • 2022-02-01
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2021-07-16
相关资源
相似解决方案