故障描述:在某些Linux的php环境下会出现中文验证码呈现繁体文、乱码、口口等不正常现象
适合版本:Discuz!x2 Discuz!x2.5 Discuz!x3 Discuz!x3.1 Discuz!x3.2
解决方法:
1.打开/source/class/class_seccode.php
2.搜索:- $this->shadow && imagettftext($this->im, $font[$i]['size'], $font[$i]['angle'], $x + 1, $y + 1, $text_shadowcolor, $font[$i]['font'], $seccode[$i]);
- imagettftext($this->im, $font[$i]['size'], $font[$i]['angle'], $x, $y, $text_color, $font[$i]['font'], $seccode[$i]);
复制代码
替换为:
- /* $this->shadow && imagettftext($this->im, $font[$i]['size'], $font[$i]['angle'], $x + 1, $y + 1, $text_shadowcolor, $font[$i]['font'], $seccode[$i]);
- imagettftext($this->im, $font[$i]['size'], $font[$i]['angle'], $x, $y, $text_color, $font[$i]['font'], $seccode[$i]);*/
- //修复中文验证码
- $seccode[$i] = mb_convert_encoding($seccode[$i], "html-entities", "utf-8");
- $this->shadow && imagettftext($this->im, $font[$i]['size'], $font[$i]['angle'], $x + 1, $y + 1, $text_shadowcolor, $font[$i]['font'], mb_convert_encoding($seccode[$i], "html-entities", "utf-8"));
- imagettftext($this->im, $font[$i]['size'], $font[$i]['angle'], $x, $y, $text_color, $font[$i]['font'], mb_convert_encoding($seccode[$i], "html-entities", "utf-8"));
复制代码
3.覆盖同名文件,更新缓存,问题解决
|