Home > Backend Development > PHP Tutorial > 图片验证码的有关问题

图片验证码的有关问题

WBOY
Release: 2016-06-13 11:38:14
Original
839 people have browsed it

图片验证码的问题
一个简单的显示验证码的代码,代码如下。 
for($i=0;$i {
 $r.=dechex(rand(1,15));
 }

$im=imagecreatetruecolor(100,30);
$bg=imagecolorallocate($im,0,0,0);//第一次调用时,背景颜色。
$te=imagecolorallocate($im,255,255,255);
imagestring($im,5,0,0,$r,$te);

header("content-type:image/jpeg");
imagejpeg($im);

图片显示不显示,如果把$r.=dechex(rand(1,15))的.去掉,图片显示,但只有一位数字。

有错误信息:Undefined variable: r。应该是变量未定义,正确的应该怎么写。

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template