php?生成验证码
哪位大哥分享下代码
------解决思路----------------------
1 | session_start();<br /> $dict = str_split ( 'abcdefghijklmnopqrstuv0123456789' );<br />shuffle( $dict );<br /> $_SESSION [ 'word' ] = join( '' , array_slice ( $dict , -4));<br /><br /> $im = imagecreate(100, 30);<br /> $bg = imagecolorallocate( $im , 255, 255, 255);<br /> $char = imagecolorallocate( $im , 0, 0, 0);<br />imagestring( $im , 5, 10, 10, $_SESSION [ 'word' ], $char );<br />imagegif( $im );
|
로그인 후 복사
------解决思路----------------------1 | <br /> session_start();<br /> $checkCode = "" ;<br /> for ( $i =0; $i <4; $i ++){<br /> $checkCode .= substr ( 'abcdefghijklmnopqrstuvwxyz0123456789' , rand(0,35), 1);
|
로그인 후 복사