日期:2014-05-17  浏览次数:20370 次

PHP求教【关于画图】
<?php
 //先做一个画布

 $im=imagecreatetruecolor(400,300);
 //默认背景是黑色
 $white=imagecolorallocate($im,255,255,255);
 imagefill($im,0,0,$white);
 //先画出扇形
 //创建三个颜色
 $red=imagecolorallocate($im,255,0,0);
 $blue=imagecolorallocate($im,0,0,128);
 $gray=imagecolorallocate($im,192,192,192);

 imagefilledarc($im,100,50,100,60,0,35,$red,IMG_ARC_PIE);
 imagefilledarc($im,100,50,100,60,36,75,$bule,IMG_ARC_PIE);
 imagefilledarc($im,100,50,100,60,76,360,$gray,IMG_ARC_PIE);
 
  header("Content-Type: image/png");
  
  imagepng($im);

  //销毁该图片,释放内存
  imagedestroy($im);

?>

 

以上是一个简单的基础代码,但在运行的时候 出现了
图片打不开的情况。

------解决方案--------------------
注释掉 header("Content-Type: image/png");
//header("Content-Type: image/png");

你将看到错误信息
Notice: Undefined variable: bule in ....