Discuz X Ucenter通信密匙正确 但一致显示通信失败

ucenter status yes

Discuz X Ucenter通信密匙正确,但在/uc_server/admin.php 里面的应用管理里面一致显示“通信失败”,这个问题困扰了我好久,排查是不是搬家把文件弄的不完整,经过比对也是正确的。

后来网上查找方法,有出现开启SSL加密(https)后出现了该问题。

最后死马当活马医的按照别人的方法尝试了一下,没想法简单操作后成功了!ucenter应用管理里面显示通信成功!

(前提是你必须保证你的config.inc.php里面的uc_key与后台/uc_server/admin.php应用管理的通信密匙一致,在文件上是没问题的。)
解决办法如下:

打开目录 uc_server/model/misc.php 文件;

找到68行左右.

1
$port = !empty($matches['port']) ? $matches['port'] : ($matches['scheme'] == 'https' ? 443 : 80);

后面

在其下插入下面代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
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);
}

ucenter——yes

此文章的评论已关闭.