Get the App
SLTechnology News&Howtos  ›  Development  › 

How to implement PHP Picture Verification Code

Shulou Source: shulou.com Published: 2022-06-03 07:49:55 11月15日 Update

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

Tags: Pictures validation characters code learning content images size quantity position font string width lowercase that is ideas situations effects articles stars Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Shulou Information MySQL Microsoft Shulou Tech Info