Initial commit
This commit is contained in:
20
20241208/img_code_1.php
Normal file
20
20241208/img_code_1.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
//GD
|
||||
//phpinfo();
|
||||
//登录验证码
|
||||
session_start();
|
||||
|
||||
header("Content-type: image/png; charset=utf-8");
|
||||
//创建一个图片
|
||||
$image = imagecreate(120,30);
|
||||
//定义背景颜色
|
||||
$black = imagecolorallocate($image,255, 0, 0);//reb 000代表黑
|
||||
//定义前景颜色
|
||||
$white = imagecolorallocate($image,255, 255, 255);
|
||||
|
||||
imagefill($image, 0, 0, $black );//向图片中填充背景
|
||||
$string = $_GET['img_code'];
|
||||
//把文字写到图片中
|
||||
imagestring( $image, 5, 6, 4, $string, $white);
|
||||
//生成png格式图形
|
||||
imagepng( $image );
|
Reference in New Issue
Block a user