完美運行
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);
}
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);
}
2017-06-05
老師實在是有1500個字,否則就會直接顯示錯誤了,count的值不需要減一嗎?你可是從數(shù)組下標為0開始算取值的
2017-05-18
我真的好奇老師是怎么顯示出來的,少了ob_clean();而且路勁設(shè)置也有問題,按照老師的來寫,路勁是有問題的,都少了“/"來進入下一層來讀取圖片,老師是怎么訪問到的?
2017-05-18
無法顯示圖片的同學(xué) 先注釋掉 header往下的兩行代碼【 header('content-type:image/jpg');
echo $contents;】,然后echo一下$filename 看一下路徑上有什么問題,如果是照著老師的敲的話,路徑中會少一根 '/'
echo $contents;】,然后echo一下$filename 看一下路徑上有什么問題,如果是照著老師的敲的話,路徑中會少一根 '/'
2017-05-17
// 創(chuàng)建一個循環(huán),循環(huán)200次
// 在循環(huán)內(nèi),用GD庫生成一個隨機顏色
// 在隨機位置上畫一個干擾點,顏色使用上面的隨機顏色
for($i=0;$i<200;$i++) {
$randColor = imagecolorallocate($image,mt_rand(0, 255),mt_rand(0, 255),mt_rand(0, 255));
$x = mt_rand(0,100);
$y = mt_rand(0,30);
imagesetpixel($image,$x,$y,$randColor);
}
// 在循環(huán)內(nèi),用GD庫生成一個隨機顏色
// 在隨機位置上畫一個干擾點,顏色使用上面的隨機顏色
for($i=0;$i<200;$i++) {
$randColor = imagecolorallocate($image,mt_rand(0, 255),mt_rand(0, 255),mt_rand(0, 255));
$x = mt_rand(0,100);
$y = mt_rand(0,30);
imagesetpixel($image,$x,$y,$randColor);
}
2017-05-05
imagestring($image,6 , 30, 10, $newCode, $red);
2017-05-05
//干擾線
for($j=0;$j<3;$j++){
$x = mt_rand(0, $width);
$y = mt_rand(0, $height);
$xx = mt_rand(0, $height);
$yy = mt_rand(0, $height);
imageline($image, $x, $y, $xx, $yy, $red);
}
for($j=0;$j<3;$j++){
$x = mt_rand(0, $width);
$y = mt_rand(0, $height);
$xx = mt_rand(0, $height);
$yy = mt_rand(0, $height);
imageline($image, $x, $y, $xx, $yy, $red);
}
2017-05-05
很多老的 libc 的隨機數(shù)發(fā)生器具有一些不確定和未知的特性而且很慢。PHP 的 rand() 函數(shù)默認使用 libc 隨機數(shù)發(fā)生器。mt_rand() 函數(shù)是非正式用來替換它的。該函數(shù)用了 » Mersenne Twister 中已知的特性作為隨機數(shù)發(fā)生器,它可以產(chǎn)生隨機數(shù)值的平均速度比 libc 提供的 rand() 快四倍。 所以用mt_rand() 能用mt的函數(shù),就用mt的
2017-05-05