天天看点

thinkphp,onethink,thinkox验证码不显示

使用验证码的时候,一开始正常,后来不显示了

网上说是utf-8的编码问题,什么bom去掉,转化为无bom的格式

我都试了,没用

后来知道是在调用验证码的地方  写上

Public function verify(){

import('ORG.Util.Image');

Image::buildImageVerify();

}

改成这样就行了

Public function verify(){

import('ORG.Util.Image');

ob_clean();//这个就是关键

Image::buildImageVerify();

}

ob_clean这个函数的作用就是用来丢弃输出缓冲区中的内容,如果你的网站有许多生成的图片类文件,那么想要访问正确,就要经常清除缓冲区。