When using php to create a picture, the picture cannot be generated normally
<code><span>header</span>(<span>"Content-type: image/png"</span>); <span>$img</span><span>=</span>imagecreatetruecolor(<span>200</span>,<span>200</span>); imagepng(<span>$img</span>); imagedestroy(<span>$img</span>);</code>
The picture that appears is this:
After clearing the cache, it will display normally. Add
ob_clean();
The code is as follows:
<code><span><span><?php </span> ob_clean(); header(<span>"Content-type: image/png"</span>); <span>$img</span>=imagecreatetruecolor(<span>200</span>,<span>200</span>); imagepng(<span>$img</span>); imagedestroy(<span>$img</span>); <span>?></span></span></span></code>
The above introduces the failure of php to draw pictures, which can be solved by clearing the cache ob_clean. , including relevant content, I hope it will be helpful to friends who are interested in PHP tutorials.