function rsaVerify($data, $ali_public_key_path, $sign) { $pubKey = file_get_contents($ali_public_key_path); $res = openssl_get_publickey($pubKey); if (!$res) { throw new Exception('公钥格式错误'); } $result = (bool) openssl_verify($data, base64_decode($sign), $res); openssl_free_key($res); return $result; }