DISCUZ开启https后,ucenter出现通信失败。这种情况一般是做完301重定向后出现的,下面是具体解决方法:

1、将discuz及其它与uc整合应用,将原http链接改为https(如果未做301强制跳转,可不改);

2、打开 uc_server/model/misc.php 文件;

找到约69行:

if($post) {

的前面,插入下面代码:

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

标签: https, discuz, ucenter

添加新评论