问题
I'm having some trouble with CKEditor.
I have created a blog for my website and a back end section to write new posts and approve comments etc. It's all working fine and I use CKEditor to write and edit posts.
When writing a text only post its fine, it gets stored in the database and subsequently appears on the website as it should. But If I write a post with an image in it it doesnt get stored in the database. All text and images disappear.
The title of the post goes into the database as this is just using a normal text box. But everything in the CKEditor disappears if I put an image in there.
Here are some screen shots:



If I dont enter an image everything works fine title and body go into the database and the blog post appears on the site.
Does anyone have any idea whats wrong here?
回答1:
I actually discovered the answer myself
The image tags created in the CKEditor would be something like
<img src="images/picture.jpg">
and my SQL query would be something like
$query = "INSERT INTO Table (blog_body, blog_title) VALUES ('".$blogBody."','".$blogTitle."')";
or something along those lines.
To solve it I just swapped the quotation marks around. Placing the query in single quotes and swapping the quotes about the variables around.
This fixed my problem.
Just thought if someone else is having this trouble this may help
来源:https://stackoverflow.com/questions/21023546/ckeditor-images-not-working