本文整理匯總了PHP中CommonUtil::trimString方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonUtil::trimString方法的具體用法?PHP CommonUtil::trimString怎麽用?PHP CommonUtil::trimString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CommonUtil
的用法示例。
在下文中一共展示了CommonUtil::trimString方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_cft_package
protected function get_cft_package()
{
try {
if (null == $this->partnerKey || "" == $this->partnerKey) {
throw new SDKRuntimeException("密鑰不能為空!" . "<br>");
}
$commonUtil = new CommonUtil();
ksort($this->parameters);
$unSignParaString = $commonUtil->formatQueryParaMap($this->parameters, false);
$paraString = $commonUtil->formatQueryParaMap($this->parameters, true);
$md5SignUtil = new MD5SignUtil();
return $paraString . "&sign=" . $md5SignUtil->sign($unSignParaString, $commonUtil->trimString($this->partnerKey));
} catch (SDKRuntimeException $e) {
die($e->errorMessage());
}
}
示例2: get_sign
protected function get_sign()
{
try {
if (null == PARTNERKEY || "" == PARTNERKEY) {
throw new SDKRuntimeException("");
}
if ($this->check_sign_parameters() == false) {
throw new SDKRuntimeException("");
}
$commonUtil = new CommonUtil();
ksort($this->parameters);
$unSignParaString = $commonUtil->formatQueryParaMap($this->parameters, false);
$md5SignUtil = new MD5SignUtil();
return $md5SignUtil->sign($unSignParaString, $commonUtil->trimString(PARTNERKEY));
} catch (SDKRuntimeException $e) {
die($e->errorMessage());
}
}
示例3: get_sign
/**
例如:
appid: wxd111665abv58f4f
mch_id: 10000100
device_info: 1000
Body: test
nonce_str: ibuaiVcKdpRxkhJA
第一步:對參數按照 key=value 的格式,並按照參數名 ASCII 字典序排序如下:
stringA="appid=wxd930ea5d5a258f4f&body=test&device_info=1000&mch_i
d=10000100&nonce_str=ibuaiVcKdpRxkhJA";
第二步:拚接支付密鑰:
stringSignTemp="stringA&key=192006250b4c09247ec02edce69f6a2d"
sign=MD5(stringSignTemp).toUpperCase()="9A0A8659F005D6984697E2CA0A
9CF3B7"
*/
protected function get_sign()
{
define('PARTNERKEY', "4YULIIKklHlMVnp5sVZek2KqVTihAhLt");
try {
if (null == PARTNERKEY || "" == PARTNERKEY) {
throw new SDKRuntimeException("密鑰不能為空!" . "<br>");
}
if ($this->check_sign_parameters() == false) {
//檢查生成簽名參數
throw new SDKRuntimeException("生成簽名參數缺失!" . "<br>");
}
$commonUtil = new CommonUtil();
ksort($this->parameters);
$unSignParaString = $commonUtil->formatQueryParaMap($this->parameters, false);
$md5SignUtil = new MD5SignUtil();
return $md5SignUtil->sign($unSignParaString, $commonUtil->trimString(PARTNERKEY));
} catch (SDKRuntimeException $e) {
// echo 'get sign error';die;
die($e->errorMessage());
}
}
示例4: get_sign
/**
* 例如:
* appid: wxd930ea5d5a258f4f
* mch_id: 10000100
* device_info: 1000
* Body: test
* nonce_str: ibuaiVcKdpRxkhJA
* 第一步:對參數按照 key=value 的格式,並按照參數名 ASCII 字典序排序如下:
* stringA="appid=wxd930ea5d5a258f4f&body=test&device_info=1000&mch_i
* d=10000100&nonce_str=ibuaiVcKdpRxkhJA";
* 第二步:拚接支付密鑰:
* stringSignTemp="stringA&key=192006250b4c09247ec02edce69f6a2d"
* sign=MD5(stringSignTemp).toUpperCase()="9A0A8659F005D6984697E2CA0A
* 9CF3B7"
*/
protected function get_sign()
{
try {
if (null == $this->apiSecret || "" == $this->apiSecret) {
throw new SDKRuntimeException("密鑰不能為空!" . "<br>");
}
if ($this->check_sign_parameters() == false) {
//檢查生成簽名參數
throw new SDKRuntimeException("生成簽名參數缺失!" . "<br>");
}
$commonUtil = new CommonUtil();
ksort($this->parameters);
$unSignParaString = $commonUtil->formatQueryParaMap($this->parameters, false);
$md5SignUtil = new MD5SignUtil();
return $md5SignUtil->sign($unSignParaString, $commonUtil->trimString($this->apiSecret));
} catch (SDKRuntimeException $e) {
die($e->errorMessage());
}
}
示例5: setParameter
/**
*設置業務參數值
*/
function setParameter($parameter, $parameterValue)
{
$commonUtil = new CommonUtil();
$this->parameters[$commonUtil->trimString($parameter)] = $commonUtil->trimString($parameterValue);
}
示例6: setParameter
function setParameter($parameter, $parameterValue)
{
$this->parameters[CommonUtil::trimString($parameter)] = CommonUtil::trimString($parameterValue);
}
示例7: getPayInfo
/**
* 獲取錯誤信息
*/
function getPayInfo()
{
$info = $this->getParameter($this->RETMSG);
if (null == CommonUtil::trimString($info) && !$this->isPayed()) {
$info = "訂單尚未支付成功";
}
return $info;
}
示例8: orderquery
public function orderquery($access_token, $trade)
{
$url = 'https://api.weixin.qq.com/pay/orderquery?access_token=' . $access_token;
// generate package
$pkg['out_trade_no'] = $trade['order_sn'];
$pkg['partner'] = $this->PARTNERID;
$commonUtil = new CommonUtil();
ksort($pkg);
$unSignParaString = $commonUtil->formatQueryParaMap($pkg, false);
$md5SignUtil = new MD5SignUtil();
$pkg_sign = $md5SignUtil->sign($unSignParaString, $commonUtil->trimString($this->PARTNERKEY));
$package_str = $unSignParaString . '&sign=' . strtoupper($pkg_sign);
$data["appid"] = $this->APPID;
$data["package"] = $package_str;
$data["timestamp"] = strval(time());
$data['app_signature'] = $this->get_biz_sign($data);
$data['sign_method'] = 'sha1';
$json_data = json_encode($data);
$ret = $this->sendPost($url, $json_data);
Log::record('wxpay orderquery order_sn:' . $trade['order_sn'] . ' res:' . print_r($ret, true), Log::INFO);
Log::save();
return $ret;
}
示例9: getPayInfo
public function getPayInfo()
{
$info = $this->getParameter($this->RETMSG);
if (NULL == CommonUtil::trimString($info) && !$this->isPayed()) {
$info = '訂單尚未支付成功';
}
return $info;
}