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

[复制链接]
本站网友  发表于 2020-1-12 19:32 |阅读模式

https后ucenter通信失败

Discuz3.4开启强制https后ucenter通信失败,一般是因为http协议301重定向至https协议后通信失败

打开目录 uc_server/model/misc.php 文件;
找到68行,
  1. $port = !empty($matches['port']) ? $matches['port'] : ($matches['scheme'] == 'https' ? 443 : 80);
复制代码

在其下插入下面代码:
  1.                 if(substr($url,0,5)=='https'){
  2.                 $ch = curl_init($url);
  3.                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  4.                 if($post){
  5.                 curl_setopt($ch, CURLOPT_POST, 1);
  6.                 curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  7.                 }
  8.                 if($cookie){
  9.                 curl_setopt($ch, CURLOPT_COOKIE, $cookie);
  10.                 }
  11.                 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  12.                 return curl_exec($ch);
  13.                 }
复制代码
测试有效

QQ|删帖注销|手机版|资源圈

GMT+8, 2024-5-5 09:53

Powered by Discuz!

© 20022-2026 Comsenz Inc.

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