header("Content-type: image/png");
$login_check_number = random(5);
$h_img = imagecreate(40,17);
$c_black = imagecolorallocate($h_img,0,0,0);
$c_white = imagecolorallocate($h_img,255,255,255);
imagestring($h_img,5,2,1,$login_check_number,$c_black);
imagepng ($h_img);
imagedestroy($h_img); function random($length) {
$hash = "";
$chars = "CEFGHIJKLMNOPQRSTUVWXYZ0123456789cefghijklmnopqrstuvwxyz";
$max = strlen($chars) - 1;
mt_srand((double)microtime() * 1000000);
for($i = 0; $i < $length; $i++)
{
$hash .= $chars[mt_rand(0, $max)];
}
return $hash;
}
$login_check_number = random(5);
$h_img = imagecreate(40,17);
$c_black = imagecolorallocate($h_img,0,0,0);
$c_white = imagecolorallocate($h_img,255,255,255);
imagestring($h_img,5,2,1,$login_check_number,$c_black);
imagepng ($h_img);
imagedestroy($h_img); function random($length) {
$hash = "";
$chars = "CEFGHIJKLMNOPQRSTUVWXYZ0123456789cefghijklmnopqrstuvwxyz";
$max = strlen($chars) - 1;
mt_srand((double)microtime() * 1000000);
for($i = 0; $i < $length; $i++)
{
$hash .= $chars[mt_rand(0, $max)];
}
return $hash;
}
解决方案 »
- php火狐怎么读取radio的值!
- smarty四则运算里面怎么用小括号?
- 求助
- .htaccess文件怎么写?它是一个文本文档还是?怎样在FTP里配置好支持伪静态的.htaccess文件?
- 散分 400分讨论精简ZF
- $tables[6];我这样定义一个数组可以吗?
- 简单的JS问题,大家看看
- phpinfo里面Virtual Directory Support 是disabled是怎么回事
- session 版的BBS,有基本的查擦改删。中英文的验证码。 登陆超时。用户略缩图
- 分数不多,问题是关于xml的解析,有愿意帮我的,加我qq: 139800319
- PHP又有重大漏洞 多语言拒绝服务漏洞事件预警
- 网页板框高度问题
的结果。啥意思?好像都是支持的
$c_black = imagecolorallocate($h_img,0,0,0);
$c_white = imagecolorallocate($h_img,255,255,255);
imagestring($h_img,5,2,1,$login_check_number,$c_white);
能不能截个图发上来看看。。
我遇到过,可能是浏览器引起的,写成下面的代码试试header("Content-type: image/x-png");