Heim  >  Artikel  >  Backend-Entwicklung  >  PHP求教【关于画图】,该如何处理

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

WBOY
WBOYOriginal
2016-06-13 12:55:591046Durchsuche

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 ....
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn