dever 6 anos atrás
pai
commit
d61c8abb4e
2 arquivos alterados com 3 adições e 11 exclusões
  1. 1 9
      lib/Wechat.php
  2. 2 2
      sdk/wechat/WxPay.Api.php

+ 1 - 9
lib/Wechat.php

@@ -25,15 +25,7 @@ class Wechat extends Core
 	 */
 	public function notify()
 	{
-		$receipt = false;
-		if (!$receipt) {
-			$receipt = file_get_contents("php://input");
-		}
-		if (!$receipt) {
-			$receipt = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : $_POST;
-		}
-
-		$this->log('支付回调-初始化', $receipt);
+		$this->log('支付回调-初始化', file_get_contents("php://input"));
 		$callback = new Callback();
 		$result = $callback->Handle($this->config, false);
 	}

+ 2 - 2
sdk/wechat/WxPay.Api.php

@@ -419,7 +419,8 @@ class WxPayApi
  	 */
 	public static function notify($config, $callback, &$msg)
 	{
-		if (!isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
+		$xml = file_get_contents('php://input');
+		if (!$xml) {
 			# 如果没有数据,直接返回失败
 			return false;
 		}
@@ -427,7 +428,6 @@ class WxPayApi
 		//如果返回成功则验证签名
 		try {
 			//获取通知的数据
-			$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
 			$result = WxPayNotifyResults::Init($config, $xml);
 		} catch (WxPayException $e){
 			$msg = $e->errorMessage();