How to solve the problem that php imagepng can't output?
How to solve the problem that php imagepng can not output, I believe that many inexperienced people are at a loss about this. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
The solution that php imagepng can not output: 1, save the file without BOM format; 2, define header and empty the cache, such as "header ('Content-Type: image/png');".
This article operating environment: windows7 system, PHP7.1 version, DELL G3 computer
What if the php imagepng output is not available?
The problem that the output picture of PHP ImagePng () cannot be displayed in the browser.
Take the randomly generated CAPTCHA code as an example. If you want to successfully output a picture to a browser, you must pay attention to two things:
Private function captcha () {ob_clean (); session_start (); header ('Content-Type: image/png'); $image=imagecreatetruecolor (100,30); / / background color is white $color=imagecolorallocate ($image, 255,255,255); imagefill ($image, 20,20, $color) $code=''; for ($iBoth / I