Esempio n. 1
0
 /**
  * 生成支付宝的链接
  * @param $out_trade_no
  * @param $subject
  * @param $total_fee
  * @param $body
  * @param $return_url
  * @param $notify_url
  * @return bool|\请求的URL地址
  */
 public static function GrantAlipayUrl($out_trade_no, $subject, $total_fee, $body, $return_url, $notify_url, $service = '', $show_url = '')
 {
     if ($config = @file_get_contents(__DIR__ . '/../config/alipay.config')) {
         $alipay_config = unserialize(base64_decode($config));
         $alipay_config['notify_url'] = $notify_url;
         $alipay_config['return_url'] = $return_url;
         $parameter = array("service" => $service ?: $alipay_config['service'], "partner" => $alipay_config['partner'], "seller_id" => $alipay_config['seller_id'], "payment_type" => $alipay_config['payment_type'], "notify_url" => $alipay_config['notify_url'], "return_url" => $alipay_config['return_url'], "anti_phishing_key" => $alipay_config['anti_phishing_key'], "exter_invoke_ip" => $alipay_config['exter_invoke_ip'], "out_trade_no" => time() . $out_trade_no, "subject" => $subject, "total_fee" => $total_fee, "body" => $body, "show_url" => $show_url, "_input_charset" => trim(strtolower($alipay_config['input_charset'])));
         require_once __DIR__ . "/../alipay/alipay_submit.class.php";
         $alipaySubmit = new \AlipaySubmit($alipay_config);
         return $alipaySubmit->buildRequestString($parameter);
     } else {
         return false;
     }
 }