for($i=0; $i<200; $i++){
$color = imagecolorallocate( $image, rand(0,255), rand(0,255), rand(0,255));
imagesetpixel($image,rand(0,100),rand(0,30),$color);
}
$color = imagecolorallocate( $image, rand(0,255), rand(0,255), rand(0,255));
imagesetpixel($image,rand(0,100),rand(0,30),$color);
}
2015-10-25
如果學(xué)過(guò)GD庫(kù)實(shí)現(xiàn)圖片水印,還可以在圖片中加入字符水印作為驗(yàn)證碼,原理是一樣的。
2015-10-19
for($i<0;$i<4;$i++){
$fontsize=6;
$fontcolor=imagecolorallocate($image,0,0,0);
$fontcontent=rand(0,9);
$x=($i*100/4)+rand(5,10);
$y=rand(5,10);
imagestring($image, $fontsize, $x, $y, $fontcontent,$fontcolor);
}
錯(cuò)在哪里
$fontsize=6;
$fontcolor=imagecolorallocate($image,0,0,0);
$fontcontent=rand(0,9);
$x=($i*100/4)+rand(5,10);
$y=rand(5,10);
imagestring($image, $fontsize, $x, $y, $fontcontent,$fontcolor);
}
錯(cuò)在哪里
2015-09-21
老師講錯(cuò)了,那個(gè)不是字體大小,就是字體。
$fontcontent = substr($data,rand(0,strlen($data)),1); 應(yīng)該改為
$fontcontent = $data[rand(0,strlen($data)-1)];
$fontcontent = $data[rand(0,strlen($data)-1)];
視頻對(duì)應(yīng)源代碼下載鏈接: http://pan.baidu.com/s/1o6pAqOM 密碼: 369x