我也报这个错,请问怎么解决的
微信支付+使用wechatpay-php开发+构建一个客户端实例 Rsa::from 报错?提示错误:Cannot load privateKey from(string), please take care about the \$thing input. /** * 构建一个客户端实例 * wechatpay-php */ public static function instanceWeChatPay() { // 商户号 $merchantId = WeChat::$merchantId; // 从本地文件中加载商户API私钥,商户API私钥会用来生成请求的签名 $merchantPrivateKeyInstance = Rsa::from(WeChat::$merchantPrivateKeyFilePath, Rsa::KEY_TYPE_PRIVATE); dd( $merchantPrivateKeyInstance ); // 商户API证书序列号 $merchantCertificateSerial = WeChat::$merchantCertificateSerial; // 从本地文件中加载微信支付平台证书,用来验证微信支付应答的签名 $platformPublicKeyInstance = Rsa::from(WeChat::$platformCertificateFilePath, Rsa::KEY_TYPE_PUBLIC); // 获取微信支付平台证书序列号 $platformCertificateSerial = PemUtil::parseCertificateSerialNo(WeChat::$platformCertificateFilePath); // 构造一个 APIv3 客户端实例 WeChat::$instance = Builder::factory([ 'mchid' => $merchantId, 'serial' => $merchantCertificateSerial, 'privateKey' => $merchantPrivateKeyInstance, 'certs' => [ $platformCertificateSerial => $platformPublicKeyInstance, ], ]); }
2022-02-23