本文將介紹提供DEDECMS遠(yuǎn)程圖片遇到Https無(wú)法本地化解決辦法,隨著HTTPS日趨由于現(xiàn)在許多網(wǎng)站使用了HTTPS技術(shù),所以我們?cè)贒EDE后臺(tái)發(fā)布文章時(shí),可能會(huì)遇到對(duì)于https的就無(wú)法本地化的問(wèn)題,關(guān)于http的遠(yuǎn)程圖片本地化,要想支持HTTPS,其實(shí)也非常簡(jiǎn)單,以下是解決辦法:
定位到文件里面GetCurContent($body)這個(gè)函數(shù)
將以下代碼:
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的遠(yuǎn)程圖片本地化的問(wèn)題就解決了!
新聞熱點(diǎn)
疑難解答
圖片精選