完美運行
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
我真的好奇老師是怎么顯示出來的,少了ob_clean();而且路勁設置也有問題,按照老師的來寫,路勁是有問題的,都少了“/"來進入下一層來讀取圖片,老師是怎么訪問到的?
2017-05-18
無法顯示圖片的同學 先注釋掉 header往下的兩行代碼【 header('content-type:image/jpg');
echo $contents;】,然后echo一下$filename 看一下路徑上有什么問題,如果是照著老師的敲的話,路徑中會少一根 '/'
echo $contents;】,然后echo一下$filename 看一下路徑上有什么問題,如果是照著老師的敲的話,路徑中會少一根 '/'
2017-05-17
//干擾線
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 的隨機數發生器具有一些不確定和未知的特性而且很慢。PHP 的 rand() 函數默認使用 libc 隨機數發生器。mt_rand() 函數是非正式用來替換它的。該函數用了 » Mersenne Twister 中已知的特性作為隨機數發生器,它可以產生隨機數值的平均速度比 libc 提供的 rand() 快四倍。 所以用mt_rand() 能用mt的函數,就用mt的
2017-05-05