代码-php怎么将验证码返回给androin?
程序员文章站
2022-05-04 20:27:54
...
代码验证码phpandroid
php生成验证码及图片的代码如下:
header('Content-type:image/png');
require_once './function.php';
$width=65;
$height=20;
$image=imagecreate($width,$height);
$bg_color=imagecolorallocate($image,0x33,0x66,0xFF);
imagefilledrectangle($image,0,0,$width,$height,$bg_color);
$text=random(5);
$font=5;
$x=imagesx($image)/2-strlen($text)*imagefontwidth($font)/2;
$y=imagesy($image)/2-imagefontheight($font)/2;
$fg_color=imagecolorallocate($image,0xFF,0xFF,0xFF);
imagestring($image,$font,$x,$y,$text,$fg_color);
$_COOKIE['captcha']=$text;
imagepng($image);
imagedestroy($image);?>
怎么给android啊