function signs($data,$pfxpath,$pfxpwd) {
$certs = array();
openssl_pkcs12_read(file_get_contents($pfxpath), $certs, $pfxpwd); // 其中pfxpath为证书路径 password为你的证书密码
if (!$certs) {
return;
}
$signature = '';
openssl_sign($data, $signature, $certs['pkey']);
return base64_encode($signature);
}