Home >Backend Development >PHP Tutorial >mysql - php stores html code into the database. How to output it according to the original style when reading it?
After exporting, the html is also output.
Or is there any other storage method?
Original style
After exporting, the html is also output.
Or is there any other storage method?
Original style
When you use the rich text editing box to edit content storage, there must be automatically generated html
tags! It must have come out when reading the area, but when you access it through the browser, it should be in the format when you save it. If the html
tag is displayed when accessing the browser, it means that the program needs to be adjusted
UEditor stores HTML format in the database. When you output, just throw it to the browser. The browser will parse it. If not, use Ajax request.
It should be that when you output, the output is text/plain, and the browser outputs the obtained content as plain text.
Add a header('Content-Type: text/html; charset=utf-8');
, so that the browser will know that this is html.
Did you use any framework? When accepting parameters, the html information is filtered, so there will be no html information when written into the library
Just use the MySQL text type to store rich text, and directly store the html code in the database