php基本的验证码

<?php
/*
 * Created on 2014-12-8
 *
 * Tge the templats erated file go to
 * indow - Prefer- P Code Templates
 */
 session_start();

$rand='';
/*设置字符*/
 for($i=0;$i<4;$i++){
 	$rand.=dechex(rand(1,15));
 }
 $_SESSION['check_pic']=$rand;
 /*设置画布大小*/
 $img=imagecreatetruecolor(100,30);
/*设置颜色*/
$bg=imagecolorallocate($img,0,0,0);
$te=imagecolorallocate($img,255,255,255);
/*将字符串写入图像*/
imagestring($img,rand(1,6),rand(1,70),rand(1,10),$rand,$te);/*图片,字体,x轴距离,y轴距离,写入的文字,写入的颜色*/
/*输出图像*/
header("Content-type: image/jpeg");
imagejpeg($img);
?>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值