//Just save the file as removebom.php, place it in the root of the server, and then execute it to remove the server-side BOM.
At the start of a little red dot in chrome
1<?PHP2 //Remove the Utf-8 BOMs3 //by magicbug at gmail dot com4 if(isset($_get[' dir ']) {//config the Basedir5 $basedir=$_get[' dir '];6}Else{7 $basedir= '. ';8 } 9 $auto= 1; TenCheckdir ($basedir); One functionCheckdir ($basedir){ A if($DH=Opendir($basedir)) { - while(($file=Readdir($DH)) !==false) { - if($file! = '. ' &&$file! = ' ... '){ the if(!Is_dir($basedir." /".$file)) { - Echo"FileName:$basedir/ - $file". Checkbom ("$basedir/$file")." <br> "; -}Else{ + $dirname=$basedir." /". - $file; +Checkdir ($dirname); A } at } - } - Closedir($DH); - } - } - in functionCheckbom ($filename) { - Global $auto; to $contents=file_get_contents($filename); + $charset[1] =substr($contents, 0, 1); - $charset[2] =substr($contents, 1, 1); the $charset[3] =substr($contents, 2, 1); * if(Ord($charset[1]) = = 239 &&Ord($charset[2]) = = 187 && $ Ord($charset[3]) = = 191) {Panax Notoginseng if($auto= = 1) { - $rest=substr($contents-R); theRewrite ($filename,$rest); + return("<font Color=red>bom found, AAutomatically removed.</font> "); the}Else { + return("<font Color=red>bom found. -</font> "); $ } $ } - Else return("BOM not Found.")); - } the - functionRewrite ($filename,$data) {Wuyi $filenum=fopen($filename, "W"); the Flock($filenum,lock_ex); - fwrite($filenum,$data); Wu fclose($filenum); - } About?>
PHP json output has?? , CSS style is not normal, remove PHP BOM Header