-
header("content-type:image/png");
- $num = $_GET['num'];
- $imagewidth=60;
- $imageheight=18;
- srand(microtime() * 100000);
-
- $numimage = imagecreate($imagewidth,$imageheight);
- imagecolorallocate($numimage,183,180,83);
- for($i=0;$i $font = mt_rand(3,5);
- $x = mt_rand(1,8)+$imagewidth*$i/4;
- $y = mt_rand(1,$imageheight/3);
- $color=imagecolorallocate($numimage,mt_rand(0,50),mt_rand(0,150),mt_rand(0,255));
- imagestring($numimage,$font,$x,$y,$num[$i],$color);
- }
- imagepng($numimage);
- imagedestroy($numimage);
- ?>
-
-
-
- 调用方法:
-
session_start();
- include_once 'conn/conn.php';
- $pattern = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLOMNOPQRSTUVWXYZ';
- $num = null;
- for($i = 0; $i $num .= $pattern{mt_rand(0, 61)};
- }
- ?>
-
复制代码
|