DEDECMS 远程图片遇到 Https 无法本地化解决办法,随着 HTTPS 日趋由于现在许多网站使用了 HTTPS 技术,所以我们在 DEDE 后台发布文章时,可能会遇到对于 https 的就无法本地化的问题,关于 http 的远程图片本地化,要想支持 HTTPS,其实也非常简单,以下是解决办法:
第一步:找到 dede/inc/inc_archives_functions.php(注:dede 目录是您的后台目录)
定位到文件里面 GetCurContent($body) 这个函数
将以下代码:
preg_match_all("/src=[\"|』|\s]{0,}(http:\/\/([^>]*)\.(gif|jpg|png|jpeg|bmp))/isU",$body,$img_array);
$img_array = array_unique($img_array[1]);
改为:
preg_match_all("/src=[\"|』|\s]{0,}(http:\/\/([^>]*)\.(gif|jpg|png|jpeg|bmp))/isU",$body,$img_array);
preg_match_all("/src=[\"|』|\s]{0,}(https:\/\/([^>]*)\.(gif|jpg|png|jpeg|bmp))/isU",$body,$img_array_https);
$img_array = array_unique($img_array[1]);
$img_array_https = array_unique($img_array_https[1]);
$img_array=array_merge_recursive($img_array,$img_array_https);
第二步
再找到:
if(!preg_match("#^http:\/\/#i", $value))
{
continue;
}
改为:
if(!preg_match("#^http:\/\/#i", $value)&&!preg_match("#^https:\/\/#i", $value))
{
continue;
}








![[奇葩一说]小仙女擦碰新车反手殴打辱骂车主](http://www.xyok.net/wp-content/uploads/2025/11/QQ_1764413294495-75x75.png)



















