2
我不明白,爲什麼線之一不被下面的代碼繪製創建的圖像:PHP GD使用功能
<?php
$canvas = imagecreatetruecolor(100, 100);
$white = imagecolorallocate($canvas, 255, 255, 255);
$black = imagecolorallocate($canvas, 0, 0, 0);
imagefill($canvas,0,0,$black);
function myLine()
{
imageline($canvas, 0,20,100,20,$white);
}
imageline($canvas, 0,60,100,60,$white); //this line is printed..
myLine(); //but this line is not
header('Content-Type: image/jpeg');
imagejpeg($canvas);
imagedestroy($canvas);
?>