1. 首页
  2. 源码

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

对于http的远程图片本地化,dedecms能很好解决,但是碰到https的就无法本地化了,以下是解决办法: 找到 dede//inc/inc_archives_functions.php文件里面GetCurContent($body)这个函数,里面 preg_match_all(“/src=[/”|’|/s]{0,}(http:////([^>]*)/.(g

对于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,}(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; }

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

注:相关教程知识阅读请移步到dedecms教程频道。
织梦安装教程 通用图文说明https://www.nanrenca.com/5928.html

相关关键词:dede模板|织梦免费模板|免费模板下载|网站源码|织梦模板|Flash网站模板

原创文章,作者:技术宅,如若转载,请注明出处:https://www.nanrenca.com/918.html

发表评论

邮箱地址不会被公开。 必填项已用*标注

联系我们

400-800-8888

在线咨询:点击这里给我发消息

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息