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;
}
解决方案 »
- 如何判断网站的xml文件有更改?
- 急需 此迅雷的 CSS 效果 ..在线等...马上放分.!
- PHP页面解析后在IE内核的浏览器显示源代码不完整的原因?
- 同键
- 这个怎么办? Undefined variable: HTTP_SERVER_VARS
- 大哥,嫂子穷疯了,便宜出卖公司网站空间!
- 请求帮助,已有 smtp类,求用法,不胜感激!!!
- 头痛!!unix下装了PHP,可惜没GD图型库,怎么办啊?:(
- Apache2.0.35 PHP4.20標版模塊編譯釋出!徵集測試!!!
- 从android客户端通过post方法发出汉字到Php,Php返回客户端,就出现乱码?怎么解决
- 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");