Discuz! · 2017 年 3 月 29 日

Discuz! X3.2 开启 https 后 UCenter 通信失败的解决方法

打开 uc_server\model\misc.php 第 68 行找到

$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);
}

通信成功!