thinkphp5给文本编辑器ueditor图片上传的路径增加网址
找到上传图片类
在thinkphpwu\public\static\hadmin\lib\ueditor\1.4.3\php中Uploader.class.php 类
查找getFileInfo方法
/**
* 获取当前上传成功文件的各项信息
* @return array
*/
public function getFileInfo()
{
return array(
"state" => $this->stateInfo,
"url" => $this->fullName,
"title" => $this->fileName,
"original" => $this->oriName,
"type" => $this->fileType,
"size" => $this->fileSize
);
}
修改控制器定义域名
define('DOMAIN','http://app.thinkphpwu.com');
修改getFileInfo 方法
加入
“url” => DOMAIN.$this->fullName,
/**
* 获取当前上传成功文件的各项信息
* @return array
*/
public function getFileInfo()
{
return array(
"state" => $this->stateInfo,
"url" => DOMAIN.$this->fullName,
"title" => $this->fileName,
"original" => $this->oriName,
"type" => $this->fileType,
"size" => $this->fileSize
);
}
验证
<p>
<img src="http://app.thinkphpwu.com/ueditor/php/upload/image/20210109/1610186390184928.png" title="1610186390184928.png" alt="company_notice.png"/>
</p>