GD库绘图报错


<?php

    $width=200;//定义图像的宽度 

    $height=50;//定义图像的高度 

    $img=imagecreatetruecolor($width,$height); 

 

    $white = imagecolorallocate ($img, 255,255,255); //白色

    //imagecolorallocate返回一个整数标识符,代表了由给定的 RGB 成分组成的颜色 

    $blue=imagecolorallocate ($img, 0,0,64); //蓝色

 

    imagestring ($img, 5, 6, 15,  "hello world", $white);//水平地画一行字符串 

    imagefill($img,0,0,$blue);//区域填充 

    

    ob_clean();

    header( 'Content-type: image/png' ); //指定图像的MIME类型  

    imagepng ($img);//以 PNG 格式将图像输出到浏览器 

?>

网上说是content-type的问题,但是我加了ob_clean(); 还是报错,是怎么回事?