加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > CMS系统 > Dedecms > 正文

织梦DEDECMS远程图片遇到https无法本地化的解决办法

发布时间:2020-12-14 05:20:17 所属栏目:Dedecms 来源:网络整理
导读:对于http的远程图片本地化,dedecms能很好解决,但是碰到https的就无法本地化了,以下是解决办法: 找到 dede//inc/inc_archives_functions.php文件里面GetCurContent($body)这个函数,里面 ? preg_match_all(“/src=[”|’|s]{0,}(http://([^]*).(gif|

对于http的远程图片本地化,dedecms能很好解决,但是碰到https的就无法本地化了,以下是解决办法:

找到 dede//inc/inc_archives_functions.php文件里面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,$img_array); 
 
preg_match_all(“/src=[”|’|s]{0,}(https://([^>]*).(gif|jpg|png|jpeg|bmp))/isU”,$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; 
} 



搞定,这样发文章就可以快乐的把https的远程图片也本地化了。
?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读