![]() |
|
首页 │ Apache │ Linux│ Java│ MySQL│ 注册│帮助 | |||
相关问题
谁知道怎么把随机数传递到页面里面啊,急!!
下面是随机数生成和图片生成的代码,用插入页面中间,但是$authnum却传不出来:
[PHP]
<?php
srand((double)microtime()*1000000);
do {
$authnum=rand()%100000;
}while($authnum >= 10000 || $authnum < 1000);
header("Content-type: image/PNG");
$im = imagecreate(50,25);
$black = ImageColorAllocate($im, 0,0,0);
$gray = ImageColorAllocate($im, 205,205,205);
imagefill($im, 50, 25,$black);
imagestring($im, 5, 6, 5, $authnum, $gray);
for($i=0;$i<200;$i++) {
$randcolor = ImageColorallocate($im, rand(155,255), rand(155,255), rand(155,255));
imagesetpixel($im, rand()%70 , rand()%30 , $randcolor);
}
ImagePNG($im);
ImageDestroy($im);
?>
[/PHP]
提问者:sunggsun 08-14 11:11
答复

