Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall
Once in a dream system for two times, suddenly found uploaded to the server, the verification code can not be displayed.
Went to the internet to find a lot of information, almost all is said permissions and the GD library problem.
However, after trying these methods, the verification code still cannot be displayed.
Later thought of doing a website before encountered a UTF-8 code BOM problem. So went to the Internet to find a section of code, removed the entire Web site file BOM. After the removal of the verification code is really shown.
Try to analyze the reason, probably because the BOM produces a blank line output. Causes the validation code to generate an error, so it cannot be displayed.
Bulk removal of the BOM method: The following code saved as a php file, accessed through the browser.
<?php
Remove the Utf-8 BOMs
by magicbug at gmail dot com
if (Isset ($_get[' dir ')) {//file directory to be removed, no arguments for file current directory.
$basedir =$_get[' dir '];
}else{
$basedir = '. ';
}
$auto = 1;
Checkdir ($basedir);
Function Checkdir ($basedir) {
if ($dh = Opendir ($basedir)) {
while ($file = Readdir ($DH))!== FAL SE) {
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);
}
?>