$crtParse = openssl_x509_parse($ssl_content); //$ssl_content 证书内容 .crt文件内容 if (!$crtParse) { return ['result' => false, 'text' => '证书内容无效' , 'time' => 3, 'url' => '']; } } if (empty($ssl_key)){ return ['result' => false, 'text' => '证书密码不能为空' , 'time' => 3, 'url' => '']; } else{ if (!openssl_x509_check_private_key($ssl_content, $ssl_key)) { //验证密钥是否与证书匹配 $ssl_key证书密钥 .key内容 return ['result' => false, 'text' => '证书密码不正确' , 'time' => 3, 'url' => '']; } }