for($i=0;$i<3;$i++){
$linecolor = imagecolorallocate($image,rand(80,220),rand(80,220),rand(80,220));
imageline($image,rand(1,99),rand(1,99),rand(1,99));
}
header( 'content-type:image/png');
imagepng($image);
imagedestroy($image);
$linecolor = imagecolorallocate($image,rand(80,220),rand(80,220),rand(80,220));
imageline($image,rand(1,99),rand(1,99),rand(1,99));
}
header( 'content-type:image/png');
imagepng($image);
imagedestroy($image);
$x=($i*100/4)+rand(5,10);
$y=rand(5,10);
imagestring($image,$fontsize,$x,$y,$fontcontent,$fontcolor);
}
for($i=0;$i<200;$i++){
$pointcolor = imagecolorallocate($image,rand(50,200),rand(50,200),rand(50,200));
imagesetpixel($image,rand(1,99),rand(1,99),$pointcolor);
$y=rand(5,10);
imagestring($image,$fontsize,$x,$y,$fontcontent,$fontcolor);
}
for($i=0;$i<200;$i++){
$pointcolor = imagecolorallocate($image,rand(50,200),rand(50,200),rand(50,200));
imagesetpixel($image,rand(1,99),rand(1,99),$pointcolor);
$image = imagecreatetruecolor(100,30);//創(chuàng)建畫布
$bgcolor = imagecolorallocate($image,255,255,255);//#ffffff背景顏色
imagefill($image,0,0,$bgcolor);//區(qū)域填充
for($i=0;$i<4;$i++){
$fontsize = 6;
$fontcolor=imagecolorallocate($image,rand(0,120),rand(0,120),rand(0,120));
;
$bgcolor = imagecolorallocate($image,255,255,255);//#ffffff背景顏色
imagefill($image,0,0,$bgcolor);//區(qū)域填充
for($i=0;$i<4;$i++){
$fontsize = 6;
$fontcolor=imagecolorallocate($image,rand(0,120),rand(0,120),rand(0,120));
;
$capth_code.=$fontcontent;這句話沒錯啊..每次循環(huán)的值賦給$capth_caode.......
2015-06-11
講課的內(nèi)容很有條理性,善于用圖來表達(dá)所有知識點(diǎn),讓人一目了然,很快就能理解需要的步驟,真的很棒!感謝!!
2015-05-14
老師的課中,有句代碼,多了個點(diǎn),$captch_code . = $fontcontent;我跟著寫,結(jié)果表單驗(yàn)證頁面的驗(yàn)證碼不顯示了,直接預(yù)覽驗(yàn)證碼頁面是HTTP500服務(wù)器錯誤,后面我吧把點(diǎn)刪了,就正常了
2015-05-10
$fontcontent = substr($data,rand(0,strlen($data)-1),1);
不然有時候缺驗(yàn)證碼
不然有時候缺驗(yàn)證碼