Windows下php通过curl发送https请求报错解决办法

Windows下php通过curl发送https请求,如果报错:curl: (60) SSL certificate problem: unable to get local issuer certificate,说明curl未找到本地证书。

以下是解决办法:
方案一:关掉curl时的证书认证

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);

方案二:本地添加证书
1:下载证书

https://curl.haxx.se/ca/cacert.pem

2:配置php.ini

[curl]
curl.cainfo = "D:\cacert.pem"

[SSL]
openssl.cafile = "D:\cacert.pem"

3:重启web服务器