为了账号安全,请及时绑定邮箱和手机立即绑定

老师好!我这个代码只能显示一个数字出来,。帮忙分析下哪里问题呢?

<?php

header ('Content-Type: image/png');

$im = @imagecreatetruecolor(120,30)

      or die('Cannot Initialize new GD image stream');

$bgcolor= imagecolorallocate($im, 255, 255, 255);

imagefill($im, 0, 0, $bgcolor);


for($i=0;$i<4;$i++){

    $fontsize=6;

    $fontcolor=imagecolorallocate($im,rand(0,120),rand(0,120),rand(0,120));

    $fontcontent=rand(0,9);

    $x=($i*100/4)+rand(5,10);

    $y=rand(5,10);

}

imagestring($im,$fontsize, $x,$y,$fontcontent,$fontcolor);


for($i=0;$i<300;$i++){

    $pointcolor=imagecolorallocate($im,rand(50,200),rand(50,200),rand(50,200));

    imagesetpixel($im,rand(1,120),rand(1,29),$pointcolor);

}

header ('Content-Type: image/png');

imagepng($im);

imagedestroy($im);

?>


正在回答

1 回答

http://img1.sycdn.imooc.com//5fc615290001e8da01700132.jpg就显示一个数字,但是数字可以变

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

老师好!我这个代码只能显示一个数字出来,。帮忙分析下哪里问题呢?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信