I wrote a verification code, but the image cannot be displayed in the local wampsever environment, but it can be displayed when I upload it to the server. The local gd library is a bit confusing for beginners! {Code ...}
A verification code is written, but the image cannot be displayed in the local wampsever environment.
But I uploaded it to the server, but it can be displayed.
The local gd library is open
A beginner gets confused and asks for advice!
Reply content:
A verification code is written, but the image cannot be displayed in the local wampsever environment.
But I uploaded it to the server, but it can be displayed.
The local gd library is open
A beginner gets confused and asks for advice!
The image is not displayed because the generated image stream is incorrect. Open the image address in the browser.
You may find that:
phpFatal error :xxxxxx or Warning : xxxxx
Error message.
In addition, display_erorrs is generally enabled locally, but in the server production environment, all error outputs are disabled for security reasons.
- Check file encoding,
utf-8Usually.
- Try
ob_clean();To clean the wrong output buffer.
Why is this code so familiar .......!
The subject should be extracted from the PHP e-commerce website development tutorial on MOOC.
This code has a BUG in
$ Fontfiles = array ("SIMYOU. TTF ");
$ Fontfile = '../fonts/'. $ fontfiles [mt_rand (0, count ($ fontfiles)-1)];
In the fonts folder, you have not placed SIMYOU. TTF or other related font files, so the server cannot find the font.
You only need to add the TTF font file.
No other content can be output for the output verification code !!
This is because display_errors is enabled in your local environment,
You only need to be at the top, that is, require_once '.. /include. php'; add ini_set ('display _ errors ', 'off') above this line.
In addition, your