Closed sunkangchina closed 2 years ago
证书
-----BEGIN CERTIFICATE-----
这里的内容就不贴了
-----END CERTIFICATE-----
openssl verify -verbose -CAfile ./CertTrustChain.pem ./WeChatPayPlatform.pem
输出
./WeChatPayPlatform.pem: OK
你是不看文档的?有你这样子引入的? 这样才对"file:///$absRootPath_cert"
,这个变量是你的文件地址
用file://
.$绝对地址
或者
$platformCertificateFilePath = file_get_contents($platformCertificateFilePath);
$platformCertificateFilePath = 'file:///path/to/wechatpay/cert.pem';
这种写法让人无语。一般定义Path就是个路径,这里的file://
后面跟绝对地址,这个手册需要优化下。
或者改成
$platformCertificateFilePath = '/path/to/wechatpay/cert.pem';
$platformCertificateFilePath = file_get_contents($platformCertificateFilePath);
建议看下README末尾的 PHP密钥/证书参数 相关说明 说明,加深一下对PHP这门语言的理解。
相当一部分的 openssl 函数需要密钥或者证书参数。可通过以下途径获取这些参数。
file://path/to/cert.pem
; 命名文件必须包含一个PEM编码的证书file://path/to/csr.pem
; 命名文件必须包含一个PEM编码的 CSRfile://path/to/file.pem
- 命名文件必须包含一个PEM编码的证书/私钥(必须包含二者)用
file://
.$绝对地址 或者$platformCertificateFilePath = file_get_contents($platformCertificateFilePath);
支付SDK你写的?!并不是,那你要按照文档的格式去做
后面2位回复多余。
运行环境
No response
描述你的问题现象
是否有明确错误提示,这提示不能加载publicKey,![image](https://user-images.githubusercontent.com/66815206/176147488-c7ce39b0-67bc-4a5d-9579-e86cfbe0c376.png)
用的https://github.com/wechatpay-apiv3/wechatpay-php/blob/main/bin/README.md 生成平台证书。