A situation where the thinkphp verification code does not appear
The official tips are as follows:
If the verification code cannot be displayed, please check:
①php has installed GD library support;
② outputs before output (especially UTF8 BOM header information output); (Open code file is garbled, also may be BOM code, can see below 2 find a solution)
Whether the ③image class library is imported correctly;
④ If it is a Chinese code check if there is a copy font file to the directory where the library is located;
⑤url_model mode, some servers do not support rewrite.
For the above situation, check each
1. You can use Phpinfo to see if the GD library is open, Phpinfo printed page can search the following information, indicating the installation of the GD library
2. Copy the code below, save it in PHP format, upload it to the server and run it, and then refresh the verification code. PS: The following code is the function of all the files in the non-BOM format encoding
PS: The source code compression package upload to the server, and then use the server decompression situation, it is easy to appear this situation. PS: After some servers open the file, the file is saved in the BOM format.
<?PHPif(isset($_get[' dir ']) {//Set file directory$basedir=$_get[' dir ']; }Else{ $basedir= '. '; } $auto= 1; Checkdir ($basedir); functionCheckdir ($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); } } functionCheckbom ($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.")); } functionRewrite ($filename,$data) { $filenum=fopen($filename, "W"); Flock($filenum,lock_ex); fwrite($filenum,$data); fclose($filenum); } ?>
Thinkphp verification code not displayed, resolution Rollup