Detailed explanation of html entity conversion UEditor editor method

高洛峰
Release: 2017-03-26 10:42:06
Original
2987 people have browsed it

After the input in the editor is submitted, when it is output, the items with

in the view table are all entities.

Solution: Just convert the content before output.

htmlspecialchars_decode()

If you need more details, please read the following:

When using the UEditor editor to save the article content in ThinkPHP 3.2.2, the data saved in the database is Escaped to entities, for example:

fonts& ;gt;

Pictured:

Detailed explanation of html entity conversion UEditor editor method

Then if you are preparing to edit the saved data in the background, if you do not do the corresponding processing, the edit box will appear:

Detailed explanation of html entity conversion UEditor editor method

Just need to remove it The data will be processed accordingly:

$con['content'] = htmlspecialchars_decode(html_entity_decode($con['content']));

then the edit box will be correct Display the saved data:

Detailed explanation of html entity conversion UEditor editor method

Attachment:

html_entity_decode(): Converts HTML entities into characters, which is the inverse function of htmlentities().

htmlspecialchars_decode(): Convert some predefined HTML entities into characters.

If the html code of


The above is the detailed content of Detailed explanation of html entity conversion UEditor editor method. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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 Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!