PHP速学教程(入门到精通)
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
我用php写了个生成验证码和图片的文件(这个文件名为captcha.php),放在服务器端。
请问,Android客户端通过访问这个文件(通过url,如localhost/web/captcha.php)如何获取一张
验证码的图片?
php生成验证码及图片的代码如下:
<code><?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);?> </code>
我用php写了个生成验证码和图片的文件(这个文件名为captcha.php),放在服务器端。
请问,Android客户端通过访问这个文件(通过url,如localhost/web/captcha.php)如何获取一张
验证码的图片?
php生成验证码及图片的代码如下:
<code><?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);?> </code>
php免费学习视频:立即学习
踏上前端学习之旅,开启通往精通之路!从前端基础到项目实战,循序渐进,一步一个脚印,迈向巅峰!
已抢7199个
抢已抢94818个
抢已抢14816个
抢已抢52063个
抢已抢194624个
抢已抢87259个
抢