PHP development verification code mixed letter and number verification code

Mixed letters and numbers verification code

Make the verification code content display a mixture of letters and numbers

Verification code of letters and numbers The difference is not big, you just need to change the generated numbers into letters and numbers.

for ($i=0;$i<4;$i++){ $fontsize = 6; $fontcolor = imagecolorallocate($image,rand(0,120),rand(0,120),rand(0,120)); $data='abcdefghijklmnopqrstuvwxyz1234567890'; $fontcontent=substr($data,rand(0,strlen($data)),1); $x = ($i * 100/4)+rand(5,10); $y = rand(5,10); imagestring($image,$fontsize,$x,$y,$fontcontent,$fontcolor); }

The difference is $data='abcdefghijklmnopqrstuvwxyz1234567890';Define a dictionary

Define the $fontcontent function and intercept the contents in the dictionary The number is displayed immediately.


Continuing Learning
||
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!