Home >Backend Development >PHP Tutorial >The php image generation code and html are mixed and garbled_PHP tutorial
When embedding a PHP image generation code into HTML, what is the reason why the PHP part appears with garbled characters?
Solution: The above code results in a picture
Treat this file as a separate PHP and call it in HTML using the tag.
Of course, inserting it directly will be garbled code, because the browser has already processed it according to HTML. Of course it won't work if you add an image format after half of it.
Calling method:
When using it, just use html syntax: Just call it. When doing verification on the server side, compare the verification characters stored in the session with the characters submitted by the user. If they are the same, Verified