function signParameters($params)
{
// 支付宝的签名串必须是未经过 urlencode 的字符串
// 不清楚为何 PHP 5.5 里没有 http_build_str() 方法
$paramStr = urldecode(http_build_query($params));
switch (strtoupper(trim($this->config['sign_type']))) {
case "MD5":
$result = md5($paramStr . $this->config['key']);
break;
case "RSA":
case "0001":
$priKey = file_get_contents($this->config['private_key_path']);
$res = openssl_get_privatekey($priKey);
openssl_sign($paramStr, $sign, $res);
openssl_free_key($res);
//base64编码
$result = base64_encode($sign);
break;
default:
$result = "";
}
return $result;
}