## 一、上傳圖片配置(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']));
~~~