tp6使用富文本编辑器
Tp6 & ueditor的配置与用法
在Tp6使用了下Ueditor,感觉与Tp5没有太大的差异:
NO1:将下载的Ueditor插件内置到项目的指定目录,一般放在public下,自己看着放,能找到就行;
NO2:页面上引用插件,如下:
<script src="/static/common/ueditor/ueditor.config.js"></script>
<script src="/static/common/ueditor/ueditor.all.min.js"></script>
NO3:页面上使用,如下:
<script type="text/plain" id="ueditor" class="content" name="content">{$content|raw}</script>
$content即为展示内容,由于含有HTML相关标签,需要用raw函数转换下才能正常显示;
NO4:js处理,如下:
//生成编辑器
UE.getEditor('ueditor',{
initialFrameWidth: 1200,
initialFrameHeight: 750
});
initialFrameWidth与initialFrameHeight表示编辑器在页面显示的宽高,可自行修改;
NO5:配置文件修改,目录在ueditor/php/config.json,可以自行修改上传图片,文件路径