火狐提示:内容编码错误,thinkPHP有麻烦 thinkphplinuxphp5 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 1、服务器不支持这种压缩格式,可使用function_exists('ob_gzhandler')判断,解决方法 ob_start('ob_gzhandler')改为ob_start();2、使用ob_start('ob_gzhandler')时候前面已经有内容输出,检查前面内容以及require include调用文件的内容。若无法找到可以在调用其它文件前使用ob_start(),调用之后使用 ob_end_clean () 来清除输出的内容;我出现的这个错误,就是由于在ob_start之前有输出内容的了。所以才导致程序运行不起来。 代码文件中是否有BOM头? 这种先行输出的问题在windows服务器下如果简单的改动了代码会有类似的问题.附上去除bom头的文件一份. 希望能帮到你.<?phpif (isset($_GET['dir'])){ //设置文件目录$basedir=$_GET['dir'];}else{$basedir = '.';}$auto = 1;checkdir($basedir);function checkdir($basedir){if ($dh = opendir($basedir)) { while (($file = readdir($dh)) !== false) { if ($file != '.' && $file != '..'){ if (!is_dir($basedir."/".$file)) { echo "filename: $basedir/$file ".checkBOM("$basedir/$file")." <br>"; }else{ $dirname = $basedir."/".$file; checkdir($dirname); } } }closedir($dh);}}function checkBOM ($filename) {global $auto;$contents = file_get_contents($filename);$charset[1] = substr($contents, 0, 1);$charset[2] = substr($contents, 1, 1);$charset[3] = substr($contents, 2, 1);if (ord($charset[1]) == 239 && ord($charset[2]) == 187 && ord($charset[3]) == 191) { if ($auto == 1) { $rest = substr($contents, 3); rewrite ($filename, $rest); return ("<font color=red>BOM found, automatically removed.</font>"); } else { return ("<font color=red>BOM found.</font>"); }}else return ("BOM Not Found.");}function rewrite ($filename, $data) {$filenum = fopen($filename, "w");flock($filenum, LOCK_EX);fwrite($filenum, $data);fclose($filenum);}?> 把文件保存成一个php文件 放到网站的根路径下, 执行一次 看屏幕输出, 如果有BOM头输出 会有红色的字提示, 然后再试试. php中if语句问题 php连接ms_sql的问题【菜鸟问题】 php提问 如何计算周岁? php中 正则表达式中如何进行断言匹配? thinkphp 调用查询类型的存储过程返回值问题 问大神,急求,因为对php还不是很了解 那位大哥帮我看下代码,关于编码转换。 验证码刷新时,session为什么不改变? 同时提交 关于XML的问题 正则问题:1与3
我出现的这个错误,就是由于在ob_start之前有输出内容的了。所以才导致程序运行不起来。
if (isset($_GET['dir'])){ //设置文件目录
$basedir=$_GET['dir'];
}else{
$basedir = '.';
}
$auto = 1;
checkdir($basedir);
function checkdir($basedir){
if ($dh = opendir($basedir)) {
while (($file = readdir($dh)) !== false) {
if ($file != '.' && $file != '..'){
if (!is_dir($basedir."/".$file)) {
echo "filename: $basedir/$file ".checkBOM("$basedir/$file")." <br>";
}else{
$dirname = $basedir."/".$file;
checkdir($dirname);
}
}
}
closedir($dh);
}
}
function checkBOM ($filename) {
global $auto;
$contents = file_get_contents($filename);
$charset[1] = substr($contents, 0, 1);
$charset[2] = substr($contents, 1, 1);
$charset[3] = substr($contents, 2, 1);
if (ord($charset[1]) == 239 && ord($charset[2]) == 187 && ord($charset[3]) == 191) {
if ($auto == 1) {
$rest = substr($contents, 3);
rewrite ($filename, $rest);
return ("<font color=red>BOM found, automatically removed.</font>");
} else {
return ("<font color=red>BOM found.</font>");
}
}
else return ("BOM Not Found.");
}
function rewrite ($filename, $data) {
$filenum = fopen($filename, "w");
flock($filenum, LOCK_EX);
fwrite($filenum, $data);
fclose($filenum);
}
?>