当前位置: > > > 在线编辑器eWebEditor字符串长度的问题(内容过长后台取不到完整数据)

在线编辑器eWebEditor字符串长度的问题(内容过长后台取不到完整数据)

最近发现使用在线编辑器eWebEditor,当文本字符超过50000个字符时,后台只能接收到一部分的数据。后来发现是由于,当超过50000个字符的时候,eWebEditor编辑器会自动把内容拆分成多个相同name的textarea提交。

比如,页面原来如下使用eWebEditor:
<input type='hidden' name='fulltext' value=''>
<iframe ID="eWebEditor1" src="edit/ewebeditor.htm?id=fulltext" frameborder="0" scrolling="no" width="100%" HEIGHT="500"></iframe>

当文字超过50000时,比如150000个字符时,编辑器就会自动将其拆分成三个textarea:
<textarea  name='fulltext'>拆分内容1</textarea>
<textarea  name='fulltext'>拆分内容2</textarea>
<textarea  name='fulltext'>拆分内容3</textarea>

解决方法:
前台页面文本域的name改成数组形式:
<input type='hidden' name='fulltext[]' value=''>
<iframe ID="eWebEditor1" src="edit/ewebeditor.htm?id=fulltext[]" frameborder="0" scrolling="no" width="100%" HEIGHT="500"></iframe>

后台数据接收的时候也使用数组进行拼接:
$fulltext= '';
foreach($_POST['fulltext'] as $key=>$val)
{
   
$fulltext.=$val;
}
评论0