CKEditor Editor upload image can not be centered and the problem of the style of confusion to solve

Source: Internet
Author: User
Yesterday, the site suddenly uploaded photos can not be displayed, and can not be centered, the background is ckeditor. Then went into the meditation, initially thought is the editor of the problem, change the editor test, or the same problem, apparently ruled out the editor's problem. What's the problem?

From the editor's input source analysis, content is quoted and HTML tags, but when submitted ckeditor will such as "<" and other pre-defined words into the HTML entity, the contents after the conversion has been manifested.

By querying the database results, the quotes in the content are replaced and blank, but the resulting data can still be interpreted in the editor, but the style is a mess and some other tags have been added. It is these causes the foreground style is disordered, causes the uploading picture to be unable to display and the center question.

Find out why, and then the idea is solved.

At this point I think of the PHP configuration file if the MAGIC_QUOTES_GPC parameter. Sure enough, this parameter is off. When turned on, data passed through Get,post,cookie is automatically escaped.

if Magic_quotes_gpc=off; In the case of a character with quotation marks (whether single or double quotes), writing directly to MySQL will become blank.

This is obviously the cause of the problem, so turn on this parameter magic_quotes_gpc=on. The data inserted into the database is displayed as normal, and the quotation marks are replaced by \ (backslash).

When fetching data, use $contents = Preg_replace ("/\\\\/", "'", $contents), and replace it with normal display in the editor.

This solves the problem. About the use of the data escaping parameters of the storage after the special composition summary.

Original: http://www.francissoung.com/biancheng/178.html

The above describes the CKEditor editor upload image can not be centered and the problem of style confusion, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.