Home  >  Article  >  Backend Development  >  PHP创建验证码时,参数的作用

PHP创建验证码时,参数的作用

WBOY
WBOYOriginal
2016-06-13 12:41:47759browse

PHP创建验证码时,求一个参数的作用?

<br />
for($i=0;$i<$num;$i++){ <br />
	$x=rand(1,8)+$imagewidth*$i/4;<br />
	$y=rand(1,$imageheight/4);<br />
	$font = ImageColorAllocate($im, rand(100,255),rand(0,100),rand(100,255)); // 生成随机颜色 <br />
	$authnum=rand(1,9); <br />
	$vcodes.=$authnum; <br />
	imagestring($im, 15, $x, $y, $authnum, $font); <br />
} <br />

在这个循环语句里,求$num的作用?

因为imagestring()函数的作用:向图像中添加数字。我认为$num肯定是用来限制向图像中添加数字的个数,
但是更改$num=4,$num=15 或者其他数字,图像中显示的仍然是4个字符。

还有我想弱弱的问一下,通过post和get传递的参数,比如login?id=2&value=3,这个id,value通过
$_POST或者$_GET获取之后,id和value的值是整数还是字符呀!

不想验证了,太麻烦,就大侠指教!!!

PHP 验证码 $_POST[]
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