Omnipay\WechatPay\Helper::sign PHP Метод

sign() публичный статический Метод

public static sign ( $data, $key )
    public static function sign($data, $key)
    {
        unset($data['sign']);
        ksort($data);
        $query = urldecode(http_build_query($data));
        $query .= "&key={$key}";
        return strtoupper(md5($query));
    }

Usage Example

 /**
  * Get the raw data array for this message. The format of this varies from gateway to
  * gateway, but will usually be either an associative array, or a SimpleXMLElement.
  * @return mixed
  * @throws InvalidRequestException
  */
 public function getData()
 {
     $this->validate('app_id', 'mch_id', 'out_trade_no');
     $data = array('appid' => $this->getAppId(), 'mch_id' => $this->getMchId(), 'out_trade_no' => $this->getOutTradeNo(), 'nonce_str' => md5(uniqid()));
     $data = array_filter($data);
     $data['sign'] = Helper::sign($data, $this->getApiKey());
     return $data;
 }
All Usage Examples Of Omnipay\WechatPay\Helper::sign