Files
ulthon_admin/dev.php

23 lines
711 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// 递归处理多级目录extend\base\admin将所有以 Class.php 结尾的文件重命名为 Base.php
$dir = './extend/base/admin';
// 递归获取所有的文件
function scan_dir($dir)
{
$files = array_diff(scandir($dir), ['..', '.']);
foreach ($files as $file) {
if (is_dir($dir . DIRECTORY_SEPARATOR . $file)) {
scan_dir($dir . DIRECTORY_SEPARATOR . $file);
} else {
if (str_ends_with($file, 'Class.php')) {
$file_path = $dir . DIRECTORY_SEPARATOR . $file;
$new_path = str_replace('Class.php', 'Base.php', $file_path);
rename($file_path, $new_path);
}
}
}
}
scan_dir($dir);