dedecms織夢https站點圖片無法遠程本地化解決辦法!
一直以來我們都是以為HTTPS網站安全性增強了,無法采集復制圖片本地化,通過技術上研究發現,通過修改織夢后臺系統文件可以解決圖片無法遠程本地化。
今天我們詳解dedecms織夢遠程圖片本地化https鏈接圖片無法本地化,現在分享給大家,也給大家做個參考。
實現步驟:
找到 dede//inc/inc_archives_functions.php文件里面GetCurContent($body)這個函數,里面
找到代碼:
preg_match_all("/src=["|'|s]{0,}(http://([^>]*).(gif|jpg|png))/isU",$body,$img_array);
$img_array = array_unique($img_array[1]);
改為:
preg_match_all("/src=["|'|s]{0,}(http://([^>]*).(gif|jpg|png))/isU",$body,$img_array);
preg_match_all("/src=["|'|s]{0,}(https://([^>]*).(gif|jpg|png))/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的遠程圖片也本地化了
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持小站。
新聞熱點
疑難解答