Detailed explanation of how to customize the size of verification code in PHP_PHP Tutorial

WBOY
Release: 2016-07-21 15:08:02
Original
823 people have browsed it

Copy code The code is as follows:

function vCode($num=4,$size=20, $ width=0,$height=0){
!$width && $width = $num*$size*4/5+5;
!$height && $height = $size + 10;
// Removed 0 1 O l and so on
                                                                                                               num; $i++){
                    $code.= $str[mt_rand(0, strlen($str)-1)]; 🎜 >                                                                                                                                               $text_color = imagecolorallocate($im, mt_rand(0,200), mt_rand(0,120), mt_rand(0,120));

                                                                                                                                                      . $back_color);
                                                                                                                                                                    . $i=0;$i<5;$i++){
                                                                                                                                  ,mt_rand (-$width,$width),mt_rand(-$height,$height),mt_rand(30,$width*2),mt_rand(20,$height*2),mt_rand(0,360),mt_rand(0,360),$ font_color);
}
// Draw interference points 255), mt_rand(0,255), mt_rand(0,255));
                                                                     Code
@imagefttext($im, $size, 0, 5, $size+3, $text_color, 'c://WINDOWS//Fonts//simsun.ttc',$code);
header( "Cache-Control: max-age=1, s-maxage=1, no-cache, must-revalidate");
header("Content-type: image/png");
imagepng($im );
                 imagedestroy($im); // 4 characters, size 20
vCode(4,20);
?>




http://www.bkjia.com/PHPjc/327500.html

www.bkjia.com

true

http: //www.bkjia.com/PHPjc/327500.html

TechArticle

Copy the code as follows: ?php function vCode($num=4,$size=20, $width=0 ,$height=0){ !$width $width = $num*$size*4/5+5; !$height $height = $size + 10; // Removed 0 1 O l and other $str...




source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!