301重定向http至https后导致站点与UCenter通信失败的解决方法 - 任刚 · Ren Gang - 我的设计笔记 世界设计 · 设计世界

在Ucenter目录找到 uc_server/model/misc.php 这个文件;

用DreamWeaver在misc.php中查找以下代码:

$port = !empty($matches['port']) ? $matches['port'] : 80;

在这段代码下方另起行添加如下代码:

if(substr($url,0,5)=='https'){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if($post){
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
}
if($cookie){
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
}
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
return curl_exec($ch);
}

保存并替换该misc.php文件,然后在Ucenter后台更新缓存,大功告成。

" /> 技巧 · 任刚 · Ren Gang - 我的设计笔记

技巧    323

301重定向http至https后导致站点与UCenter通信失败的解决方法

小贴士      

Form to Mail – 留言表单数据自动发送至指定邮箱

小贴士      

PHPCMS V9 缩略图模糊不清的解决办法

小贴士      

登 录 注 册