PHP头条
热点:

php生成验证码实例代码


下面是生成验证码代码,结果编程之家本站测试过,没错误贴上来的。如果有什么不懂的地方可以回复,编程之家会为你解释不了解之处。希望能对你有所收获。

  1. <?php
  2. session_start();
  3. $nums       = rand(1000,9999);
  4. $_SESSION[nums]=$nums;
  5. $imgs = ImageCreatetruecolor(100, 35);
  6. $one = Imagecolorallocate($imgs, 0, 0, 0);
  7. $two = Imagecolorallocate($imgs, rand(0, 255), rand(0, 255), rand(0, 255));
  8. $thr = Imagecolorallocate($imgs, rand(50, 200), rand(100, 255), rand(150, 255));
  9. Imagestring($imgs, 6, rand(5, 60), rand(3, 18), $nums, $two);
  10. for ($i = 1; $i <= 3; $i ) {
  11.     imageline($imgs, rand(0, 0), rand(0, 25), rand(70, 100), rand(0, 25), $thr);
  12. }
  13. for ($i = 1; $i <= 200; $i ) {
  14.     imagesetpixel($imgs,rand()0,rand()5,$two);
  15. }
  16. Header("Content-type:image/jpeg");
  17. imagejpeg($imgs);
  18. ?>

www.phpzy.comtrue/phprm/24633.htmlTechArticlephp生成验证码实例代码 下面是生成验证码代码,结果编程之家本站测试过,没错误贴上来的。如果有什么不懂的地方可以回复,编程之家会为你解释不了解之处。希望能对你有所收获。...

相关文章

    暂无相关文章

PHP之友评论

今天推荐