


PHP fails to draw pictures, which can be solved by clearing the cache ob_clean.
Jul 30, 2016 pm 01:31 PMWhen 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.

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Go clean detailed explanation: efficient cleaning of compiled products

Go clean guide: Cleaning and managing Go projects
