关于php生成图形验证码我们讲过很多,这是一个非常简单的适合于php入门者的教程,一个用php生成验证码的实例代码.
- <?php
- $height = 300;
- $width = 300;
-
- $im = ImageCreateTrueColor($width, $height);
-
- $white = ImageColorAllocate ($im, 255, 255, 255);
- $blue = ImageColorAllocate ($im, 0, 0, 64);
-
- ImageFill($im, 0, 0, $blue);
-
- ImageString($im, 10, 100, 120, 'Hello,PHP', $white);
-
- Header ('Content-type: image/png');
-
- ImagePng($im);
-
- ImageDestroy($im);
- ?>
|