## 一、上传图片配置(ueditor/php/config.json,其他配置类似)
~~~
"imageUrlPrefix": "http://localhost:8080/FRONT_SITE/web", /* 图片访问路径前缀 */
"imagePathFormat": "./Uploads/images/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
~~~
## 二、文件路径修改(ueditor/php/Uploader.class.php)
~~~
/**
* 获取文件完整路径
* @return string
*/
private function getFilePath()
{
$fullname = $this->fullName;
$rootPath = $_SERVER['DOCUMENT_ROOT'].'/FRONT_SITE/web';
// $rootPath = $_SERVER['DOCUMENT_ROOT'];
if (substr($fullname, 0, 1) != '/') {
$fullname = '/' . $fullname;
}
return $rootPath . $fullname;
}
~~~
## 三、ueditor实始化
~~~
<script id="js_content" type="text/plain" style="height: 300px;"></script>
<script type="text/javascript" src="__CJS__/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__CJS__/ueditor/ueditor.all.min.js"></script>
<script>
// 富文本编辑器
var ue = UE.getEditor('js_content', {
toolbars: [
[
'fontfamily',
'fontsize',
'forecolor', 'bold',
'underline', 'horizontal',
'justifyleft',
'justifycenter',
'justifyright',
'link', 'date',
'simpleupload',
'attachment',
'undo',
'redo',
'insertcode'
]
]
});
ue.setOpt("insertcode", {html: "Xml", js: "Javascript", css: "Css", php: "Php",sql: "Sql", java: "Java", cpp: "C/C++",bash: "Bash/Shell"});
</script>
~~~
## 四、替换下载域名
~~~
$mrList[$k]['content'] = str_replace('http://localhost:8080', 'http://192.168.112.34:8080', html_entity_decode($v['content']));
~~~