Home  >  Article  >  php教程  >  thinkphp,onethink和thinkox中验证码不显示的解决方法分析,thinkphpthinkox

thinkphp,onethink和thinkox中验证码不显示的解决方法分析,thinkphpthinkox

WBOY
WBOYOriginal
2016-07-06 14:25:171475browse

thinkphp,onethink和thinkox中验证码不显示的解决方法分析,thinkphpthinkox

本文实例讲述了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这个函数的作用就是用来丢弃输出缓冲区中的内容,如果你的网站有许多生成的图片类文件,那么想要访问正确,就要经常清除缓冲区。

更多关于thinkPHP相关内容感兴趣的读者可查看本站专题:《ThinkPHP入门教程》、《ThinkPHP常用方法总结》、《PHP中cookie用法总结》、《smarty模板入门基础教程》及《PHP模板技术总结》。

希望本文所述对大家基于ThinkPHP框架的PHP程序设计有所帮助。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn