Laravel ckeditor 数据没有插入数据库
Laravel ckeditor data doesn't insert in database
我正在使用 Laravel 5.2 并使用 UniSharp/laravel-ckeditor 包在我的 project.Everything 中实现 ckeditor 似乎工作 fine.But 当我发送 ckeditor 输入字段的数据时,它不是插入 database.The 其他输入字段工作的数据 fine.When 我使用普通文本区域而不是 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();
}
Textarea as HTML 标记插入不正确。您应该按如下方式更改代码:
My Editor:<br>
<textarea name="article-ckeditor" id="article-ckeditor"><p>Initial editor content.</p></textarea>
<script>
CKEDITOR.replace( 'article-ckeditor' );
</script>
同样在您的控制器中,没有名为 Input 的函数,它是输入。按如下方式更改您的控制器:
public function gettopics(Request $request){
$topic=new Topic;
$topic->title=$request->input('title');
$topic->detail=$request->input('detail');
$topic->save();
}
要呈现 html 内容,请执行此操作
{{!! $topic->detail !!}}
请注意,如果spaced 错误,它将不起作用。因此,请确保在第一个 '!!' 之前 space 没有 space 在 最后一个 '!!' 之后。
我正在使用 Laravel 5.2 并使用 UniSharp/laravel-ckeditor 包在我的 project.Everything 中实现 ckeditor 似乎工作 fine.But 当我发送 ckeditor 输入字段的数据时,它不是插入 database.The 其他输入字段工作的数据 fine.When 我使用普通文本区域而不是 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();
}
Textarea as HTML 标记插入不正确。您应该按如下方式更改代码:
My Editor:<br>
<textarea name="article-ckeditor" id="article-ckeditor"><p>Initial editor content.</p></textarea>
<script>
CKEDITOR.replace( 'article-ckeditor' );
</script>
同样在您的控制器中,没有名为 Input 的函数,它是输入。按如下方式更改您的控制器:
public function gettopics(Request $request){
$topic=new Topic;
$topic->title=$request->input('title');
$topic->detail=$request->input('detail');
$topic->save();
}
要呈现 html 内容,请执行此操作
{{!! $topic->detail !!}}
请注意,如果spaced 错误,它将不起作用。因此,请确保在第一个 '!!' 之前 space 没有 space 在 最后一个 '!!' 之后。