我有一个使用Summernote的CodeIgniter视图
<div class="col-lg-12 col-sm-12 col-xs-12">
<label for="definpu">Requirement</label>
<textarea class="input-block-level" id="requirement" name="requirement" rows="18">
<?php if (isset($selected_record)): echo htmlspecialchars_decode($selected_record->requirement); endif; ?>
</textarea>
</div>
...
<script src="<?php echo base_url(); ?>assets/js/editors/summernote/summernote.js"></script>
<script>
$('#requirement').summernote({ height: 100 });
</script>
`
如果我使用Summernote选项编写文本并设置其格式,那么它似乎可以正常工作(我还没有尝试过所有方法),但是当我从Word文档中复制/粘贴文本时,它甚至都没有出现$ _POST。因此,根据文本区域的内容,在$ _POST中检索的值是文本(如果是简单格式)还是空字符串(如果由于某种原因而不能接受格式)。
就我而言,文本是从Word粘贴的,我可以看到Summernote生成的源,看起来不错:
`
echo '<style type="text/css">p { margin-bottom: 0.08in; direction: ltr; font-size: 12pt; text-align: left; background: transparent none repeat scroll 0% 0%; }a:link { color: rgb(0, 0, 255); text-decoration: underline; }a.ctl:link { font-family: "Times New Roman"; }a.sdfootnotesym-ctl { font-family: "Times New Roman"; }</style>
<ul><li><p style="margin-top: 0.04in; margin-bottom: 0.04in; line-height: 115%" align="justify">
<font face="Calibri, serif"><font style="font-size: 11pt" size="2"><font face="Arial, serif"><font style="font-size: 10pt" size="2">Be
able to EDIT the “fixed cells (i.e. Job Type, Request Type, etc.)
without it requiring us to redo the entire request.</font></font> </font></font></p>
</li></ul>';
`
但是,当我点击“保存(提交)”时,我所在区域的$ _POST为空。如果我自己开始输入文字,则可以使用,但是格式当然会有所不同。
那么有没有一种方法可以解决这个问题,并且如果可以从复制/粘贴生成代码,则可以将其保存在数据库中然后显示出来?
再次,我的问题是将其保存到数据库。要检索,我使用“ htmlspecialchars_decode”,这似乎解决了正确显示的问题。
谢谢!