首页 >后端开发 >php教程 >代码-php怎么将验证码返回给androin?

代码-php怎么将验证码返回给androin?

WBOY
WBOY原创
2016-06-02 11:32:58866浏览

代码验证码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啊

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn