原创文章来自:
https://www.ympfb.com/show-27-43-1.html
第一步:
phpcms/modules/member/classes/client.class.php中361行增加这条
p
o
r
t
=
!
e
m
p
t
y
(
port = !empty(
p
o
r
t
=
!
e
m
p
t
y
(
matches[‘port’]) ?
m
a
t
c
h
e
s
[
′
p
o
r
t
′
]
:
(
s
t
r
t
o
l
o
w
e
r
(
matches[‘port’] : ( strtolower(
m
a
t
c
h
e
s
[
′
p
o
r
t
′
]
:
(
s
t
r
t
o
l
o
w
e
r
(
matches[‘scheme’])==‘https’ ? 443 : 80 );
第二步:
phpcms/modules/member/classes/client.class.php中386行
f
p
=
@
f
s
o
c
k
o
p
e
n
(
(
fp = @fsockopen((
f
p
=
@
f
s
o
c
k
o
p
e
n
(
(
ip ? $ip : $host), $port, $errno, $errstr, $timeout);替换,把这段替换成下面的代码
$contextOptions = array(
‘ssl’ => array(
‘verify_peer’ => false,
‘verify_peer_name’ => false
)
);
//如果有签名的证书
//$contextOptions = array(
// ‘ssl’ => array(
// ‘verify_peer’ => true,
// ‘cafile’ => ‘/path/to/cacert.pem’,
// //‘CN_match’ => ‘indexroot.net’, // 匹配域名
// ‘ciphers’ => ‘HIGH:!SSLv2:!SSLv3’,
// ‘disable_compression’ => true,
// )
//);
c
o
n
t
e
x
t
=
s
t
r
e
a
m
c
o
n
t
e
x
t
c
r
e
a
t
e
(
context = stream_context_create(
c
o
n
t
e
x
t
=
s
t
r
e
a
m
c
o
n
t
e
x
t
c
r
e
a
t
e
(
contextOptions);
KaTeX parse error: Expected ‘}’, got ‘EOF’ at end of input: …client(“ssl://{
host}:{$port}”, $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, $context);
就好了