【发布时间】:2016-02-02 15:51:50
【问题描述】:
我在我的 laravel 项目中使用 ckeditor。我的问题不是所有的 html 标签都插入到我的数据库中。
这是我在 ckeditor 中的源 html 示例:
<h1><font face="courier new, courier, monospace"><strong>this value of textarea</strong></font></h1>
当我点击提交时,只有<strong>this value of textarea</strong> 插入到我的数据库中。
我 print_r(Input::all()); 时的输出:
Array
(
[_token] => xVqWzYv0WK9w7xLJjcDHW6kCQARCChaGzVM9usbU
[title] => test title
[summary] => <h1><font face="courier new, courier, monospace"><strong>this value of textarea</strong></font></h1>
[category] => 20
)
这是我的代码:
$post = $this->question->getById($id);
if ( ! $this->validator->validEdit(Input::all()))
{
return Redirect::back()->withInput()->withErrors($this->validator->errors());
}
$post = $this->question->edit($post, Input::all());
【问题讨论】:
-
你能分享你的编辑方法的代码吗?我想,它是将返回的数据添加到数据库中的那个。确保使用 PDO 或尝试 php $post->summary = mysql_real_escape_string($post->summary) 。
-
鳕鱼看起来一切都很好,也许你搞砸了别的东西?
-
在数据库中检查您的
Length/Values。