Home  >  Article  >  Backend Development  >  PHP求教【关于画图】,该如何处理

PHP求教【关于画图】,该如何处理

WBOY
WBOYOriginal
2016-06-13 12:55:591051browse

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 ....
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn