Laravel ckeditor数据不能插入数据库
Laravel ckeditor data doesn't insert in database
我使用的是Laravel 5.2,并使用UniSharp/Laravel -ckeditor包在我的项目中实现ckeditor。一切似乎都很顺利。但当我发送ckeditor输入字段的数据时,它并没有插入数据库。其他输入字段的数据工作正常。当我使用普通文本区域而不是ckeditor时,它也工作得很好。
在我看来: {{Form::open(array('url'=>'gettopics'))}}
<input type="text" name="title" class="form-control"/>
**<input type="textarea" name="detail" id="article-ckeditor">**
{{Form::close()}}
<script>
CKEDITOR.replace( 'article-ckeditor' );
</script>
的路线:
Route::post('gettopics','TopicsController@gettopics');
控制器:
public function gettopics(Request $request){
$topic=new Topic;
$topic->title=$request->Input('title');
$topic->detail=$request->Input('detail');
$topic->save();
}
要呈现html内容,请执行以下操作
{{!! $topic->detail !!}}
注意,如果空格错误,它将不起作用。因此,请确保在第一个'!! !后",没有空间最后的! !"。
Textarea作为HTML标签插入错误。你应该这样修改你的代码:
My Editor:<br>
<textarea name="article-ckeditor" id="article-ckeditor"><p>Initial editor content.</p></textarea>
<script>
CKEDITOR.replace( 'article-ckeditor' );
</script>
同样在你的控制器中,没有叫做Input的函数,它是Input。修改你的控制器如下:
public function gettopics(Request $request){
$topic=new Topic;
$topic->title=$request->input('title');
$topic->detail=$request->input('detail');
$topic->save();
}
相关文章:
- 使用formData使用ajax将图像插入数据库
- 如何访问日期并将其插入数据库?节点.JS&MongoDB
- 使用Mysqli、PHP和AJAX的聊天系统正在将空白消息插入数据库
- AJAX PHP 连接将行插入数据库
- 使用 pur Html 和 Javascript 将文件插入数据库
- 将表单数据插入数据库后无法重定向到 html 页面
- 将整数变量插入数据库
- 单击按钮可多次动态添加选择框、文本框和日期,并将这些值插入数据库
- 动态选择列表AJAX和插入数据库表通过张贴形式
- 无法使用ajax序列化功能将图像插入数据库
- 使用ajax进行内联编辑(将值插入数据库)
- 将捕获的图像插入数据库问题(Cordova/SQlite/JavaScript)
- 如何在 PHP 中将动态表值插入数据库
- 将数据插入数据库express/mongodb应用程序时出错
- 通过API将视频信息插入数据库
- 我想单击一个
- 并获取 id 以通过 POST 将其插入数据库,可以吗?
- 如何将翻译后的文本插入数据库 php
- PHP-插入数据库而不刷新页面(OOP)
- MongoDB在将文档插入数据库之前为空集合
- 将本地存储值插入数据库