你可以下utf-8和gb2312的dedecms啊, 把模板文件换了就行,如果用批处理或php,速度也去不了那里
解决方案 »
- register_shutdown_function (array(&$this, '__destruct'))解释一下~谢谢大家
- 字符串中屏[]问题,在线等
- 页面在后退时提示过期,如何让它不再显示过期而直接显示页面。
- 网站根目录问题
- 如何判断用户是否在线(给个思路)
- 急,请教apache的配置问题
- php如何备份oracle
- 大家来帮一下忙吧,应该是很简单的,谢谢了
- 天那,这样也会错?$mydb[$i][fair_type_name]
- php做验证码输出图片显示的是乱码,怎么破?
- 像新浪微博那样子,发表文章之后,页面不转跳,文章自动显示在第一行是如何做到的啊?
- php socket 发送数据结构
static $aTempArr=array();
$dp=opendir($sDir);
while ($sFileName = readdir($dp)){
if ($sFileName !='.' && $sFileName !='..'){
$sPath=$sDir."/" . $sFileName;
if ( is_dir($sPath)){
explorerdir($sPath);
} else {
// $filetime=date("Y-m-d H:i:s",filectime("$path"));
// $fp=$path.",".$filetime;
$fp=$sPath;
$aTempArr[]=$fp;
}
}
}
closedir($dp);
return $aTempArr;
}
$aFiles = explorerdir("路径");
foreach($aFiles as $iKey => $sFiles) {
$sContent = file_get_contents($sFiles);
$sContent = str_ireplace('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />', '<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />', $sContent);
file_put_contents($sFiles, $sContent);
unset($sContent);
}
回coolesting ,如果是自己做的模板或者下载人家的模板,而且数量很多,这样做就有点慢了。能快就快
方法二,遍历文件,将文件读取后,再转换格式,再生成。
是这个吧:http://www.20ju.com/content/V52930.htm
我用它将utf-8文件转为gbk文件,结果出来时乱码的
function explorerdir($sDir){
static $aTempArr=array();
$dp=opendir($sDir);
while ($sFileName = readdir($dp)){
if ($sFileName !='.' && $sFileName !='..'){
$sPath=$sDir."/" . $sFileName;
if ( is_dir($sPath)){
explorerdir($sPath);
} else {
// $filetime=date("Y-m-d H:i:s",filectime("$path"));
// $fp=$path.",".$filetime;
$fp=$sPath;
$aTempArr[]=$fp;
}
}
}
closedir($dp);
return $aTempArr;
}
$aFiles = explorerdir("D:/wamp/www/dedecms/templets/default");
foreach($aFiles as $iKey => $sFiles) {
$sContent = file_get_contents($sFiles);
$sContent = str_ireplace('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />', '<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />', $sContent);
$sContent = iconv("UTF-8", "gb2312", $sContent);
unlink($sFiles);
file_put_contents($sFiles, $sContent);
unset($sContent);
}
我试了下这样是可以的