Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem that the picture of verification code generated by php can not be opened?

2025-03-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article introduces how to solve the problem that the picture of php CAPTCHA can not be opened. The content is very detailed. Interested friends can use it for reference. I hope it can help you.

Php generated CAPTCHA image can not open the solution: 1, block the output image code; 2, check the code errors; 3, check whether the gd library is open; 4, modify the font path when generating CAPTCHA; 5, add the "ob_clean ()" code.

This article operating environment: Windows7 system, PHP7.1, Dell G3 computer.

What if the picture of php generated CAPTCHA cannot be opened?

The problem that the CAPTCHA picture generated by php does not display

1. First block out the code to output the picture: header ("Content-Type:image/png")

two。 Visit the picture and check for code errors

3. Then check whether there is an output before the CAPTCHA. If there is an output, the CAPTCHA will not be displayed

4. Check whether the gd library is open

5. The CAPTCHA does not display or report an error; refresh the page, and the CAPTCHA is fleeting because the font path is incorrect (it must be an absolute path) when the CAPTCHA is generated, as shown in the figure:

6. If there is no problem, it can be solved perfectly by adding ob_clean () code before header ("Content-Type:image/png") (Note: the purpose of ob_clean () is to clear the ob cache)

On how to solve the php generation of CAPTCHA pictures can not open the problem to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report