编辑器下载地址:http://ueditor.baidu.com/website/download.html#ueditor
放在项目Public或者入口同级目录均可。
前台代码
<div class="layui-form-item layui-form-text"> <label class="layui-form-label">文章内容</label> <div class="layui-input-block"> <script src="__ADMIN__/ueditor/ueditor.config.js" type="text/javascript"></script> <script src="__ADMIN__/ueditor/ueditor.all.js" type="text/javascript"></script> <textarea name="content" rows="80%" style="80%; border: none;" id="myEditor" placeholder="请输入内容" autofocus="true" class="layui-textarea"></textarea> <script type="text/javascript"> var editor = new UE.ui.Editor(); editor.render("myEditor"); </script> </div> </div>
后台就是接收输入内容存入数据库即可。
后期查询改内容时会出现带有html标签,用htmlspecialchars过滤即可!