修改主题、插件ID
使用这个代码,可以将某个插件或主题内的所有特定文件中的内容改为你想要的id。
<?php
$scanDir = '/home/wwwroot/default/zb_users/theme/video'; //文件夹
$ext = array('php','js','css','txt','xml'); //需要更改的文件后缀
$text = 'video'; //原id
$newText = 'shiping'; //新id
function dirfolder($dir){
global $ext,$text,$newText;
foreach (scandir($dir) as $value) {
if ($value != '.' && $value != '..'){
$path = $dir.'/'.$value;
if (is_dir($path)){
dirfolder($path);
}else{
if (preg_match('/\.('.implode('|',$ext).')$/',$path)){
$str = file_get_contents($path);
if (strpos($str,$text) !== false){
$str = str_replace($text,$newText,$str);
file_put_contents($path,$str);
}
}
}
}
}
}
dirfolder($scanDir);

