dedecms上传图片相对路径改成绝对路径方法

时间:2023-03-09 19:33:42
dedecms上传图片相对路径改成绝对路径方法

很多朋友使用dedecms的时候都用了二级域名的功能,所以造成很多文章中图片不显示的问题。

解决方案如下:

1. 进入dede后台“系统”-“系统基本参数”-“核心设置”,开启支持多站点。

2. 找到 include/dialog/select_images_post.php 第108行下增加:

if($cfg_multi_site) $fileurl = $cfg_basehost.$fileurl;

3. 在include/dialog/select_images.php,第59行下增加:

if($cfg_multi_site){ $cfg_remote_site = 'Y'; $remoteuploads = 1; $remoteupUrl = $cfg_basehost;}

4. 在include/helpers/upload.helper.php中

第29行,增加$cfg_multi_site, $cfg_basehost;
第107行后面增加:if($cfg_multi_site) $fileurl = $cfg_basehost.$fileurl;

完美解决所有图片上传问题!