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?

mysql - php stores html code into the database. How to output it according to the original style when reading it?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-08-04 09:19:18
Original
1285 people have browsed it

After exporting, the html is also output.
Or is there any other storage method?
mysql - php stores html code into the database. How to output it according to the original style when reading it?

Original style

mysql - php stores html code into the database. How to output it according to the original style when reading it?

Reply content:

After exporting, the html is also output.
Or is there any other storage method?
mysql - php stores html code into the database. How to output it according to the original style when reading it?

Original style

mysql - php stores html code into the database. How to output it according to the original style when reading it?

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

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template