Font in$this->font = dirname(__FILE__).'/font/elephant.ttf';
Display background:
imagefilledrectangle($this->img,0,$this->height,$this->width,0,$color);
Display code:
imagettftext($this->img,$this->fontsize,mt_rand(-30,30),$_x*$i+mt_rand(1,5),$this->height / 1.4,$this->fontcolor,$this->font,'字');
The verification code can be displayed in windows, as follows:
This is the only way in centos
There is no gd extension on centos
Turn on error messages to know what went wrong display_errors