Thinkphp verification code not displayed, resolution Rollup

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.