找回密码
 立即注册
查看: 39|回复: 0

[教程] Discuz3.4开启.https后ucenter通信失败解决方法

[复制链接]

131

主题

189

回帖

831

积分

管理员

UID
2
阅读权限
200
在线时间
56 小时
注册时间
2012-6-24
最后登录
2026-3-7
发表于 2020-7-9 09:56:00 | 显示全部楼层 |阅读模式
https后ucenter通信失败
Discuz3.4开启强制https后ucenter通信失败,一般是因为http协议301重定向至https协议后通信失败

打开目录 uc_server/model/misc.php 文件;
找到68行,

$port = !empty($matches['port']) ? $matches['port'] : ($matches['scheme'] == 'https' ? 443 : 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);
                }


测试有效
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|网间品茗记录生活 ( 冀ICP备2024049637号|冀公网安备13100002000150号 )

GMT+8, 2026-3-11 07:14 AM

www.shengfang.ren Email,xiaoyaozhongqiu@126.com

© 2007-2026 caizhongqiu

快速回复 返回顶部 返回列表