一、在后台打开百度的编辑器显示下图

二、访问UEditor富文本编辑器以下这个文件 /ueditor/php/controller.php 是否返回以下

三、再次访问UEditor富文本编辑器 /ueditor/php/controller.php?action=config 返回以下错误

出现在以上三个问题,可以确认是UEditor富文本编辑器 /ueditor/php/controller.php 这个文件下的这个
$CONFIG = json_decode(preg_replace("//*[\s\S]+?*//", “”, file_get_contents(“config.json”)), true);
引入config.json路径错误造成的

修改如下
$CONFIG = json_decode(preg_replace("/\/\*[\s\S]+?\*\//", "", file_get_contents($_SERVER['DOCUMENT_ROOT']."/public/static/ueditor/php/config.json")), true);

$_SERVER[‘DOCUMENT_ROOT’]."/public/static/ueditor/php/config.json" 是config.json这个文件的绝对路径
本文档介绍了在后台使用百度UEditor富文本编辑器时遇到的三个问题,包括编辑器显示异常、控制器返回错误等内容。问题根源在于config.json路径错误。解决方案是修正配置文件路径为绝对路径:`$_SERVER['DOCUMENT_ROOT']./public/static/ueditor/php/config.json`。通过此修复,确保了UEditor能正确加载并运行。
2783

被折叠的 条评论
为什么被折叠?



