我想通过在我的项目文件夹和子文件夹文件中的所有 php 和其他文件中用空格替换它来更改一些代码。我有以下代码。
if ($handle = @ opendir("for testing")) {
while (($entry = readdir($handle)) ) {
if ($entry != "." && $entry != "..") {
$linecop = '/*god_mode_on*eval(test("ZXkViKSk7IA=="));*god_mode_off*/';
$homepage = file_get_contents($entry);
$string3=str_replace($linecop,'',$homepage);
$file = fopen($entry, "w") or exit("Unable to open file!");
fwrite($file, $string3);
fclose($file); //
}
}
closedir($handle);
}
但是此代码仅适用于一个文件。如何更改所有文件?