Home >Backend Development >PHP Tutorial >代码-php怎么将验证码返回给androin?

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

WBOY
WBOYOriginal
2016-06-02 11:32:58886browse

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn