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;
}
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容