PHP开发实例大全(提高卷) 中文完整pdf扫描版[244MB]
1、是否已成功安装了GB库
2、验证码类放置的位置,以及加载的路径是否正确 import("@.ORG.Util.Image");--放在项目包里加载方式 import('ORG.Util.Image');--放在核心扩展包的加载方式 3、检查一下是否少了String类,如果不少,和Image是否在同一个目录下。 4、检查一下页面编码是不是UTF8 ,不是的话转换 5、如果是缓存造成的,清除一下BOM,方法是找到一个清除BOM的类,到thinkphp官方论坛里找。 6、不同版本的核心包验证码类有些是有出入的,试着打开Image.class.php中的output函数中的ob_clean();注释掉或者加上,调试一下 清除BOM类: <?php 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."); } 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,对文件绝对安全,亲测过的
转载请注明:谷谷点程序 » thinkphp验证码不显示