How to implement PHP Picture Verification Code
This article mainly explains "how to achieve PHP picture verification code", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "how to achieve PHP picture verification code" bar!
1. Display effect
Second, the code is as follows
The copy code is as follows:
/ *
* @ Author fy
, /
$imgwidth = 100; / / Picture width
$imgheight = 40; / / Picture height
$codelen = 4; / / length of CAPTCHA
$fontsize = 20; / / font size
$charset = 'abcdefghkmnprstuvwxyzABCDEFGHKMNPRSTUVWXYZ23456789'
$font = 'Fonts/segoesc.ttf'
$im=imagecreatetruecolor ($imgwidth,$imgheight)
$while=imageColorAllocate ($im,255255255)
Imagefill ($im,0,0,$while); / / fill image
/ / get the string
$authstr=''
$_ len = strlen ($charset)-1
For ($iSuppli