thinkphp5.0 中简单处理微信支付异步通知

 1 public function wx_notify(){
 2         $postStr = $GLOBALS["HTTP_RAW_POST_DATA"];
 3         libxml_disable_entity_loader(true);
 4         $xml = json_decode(json_encode(simplexml_load_string($postStr, ‘SimpleXMLElement‘, LIBXML_NOCDATA)), true);        
 5         if($xml[‘out_trade_no‘]){
 6             $rs = Db::name(‘order_jiaoche‘)->where(array(‘order_sn‘=>$xml[‘out_trade_no‘]))->find();
 7             if($rs){
 8                 Db::name(‘order_jiaoche‘)->where(array(‘order_sn‘=>$xml[‘out_trade_no‘]))->update(array(‘ispay‘=>1));
 9                 echo ‘success‘;
10             }
11         }        
12          /*
13          调试所用 
14          $fp = fopen(‘notify.txt‘,‘a+‘); 
15          fwrite($fp,"\n _______GET________");   
16          fwrite($fp,var_export($xml,true));     
17          fwrite($fp,"\n ________postObj________");
18          fwrite($fp,var_export($xml,true));
19          fwrite($fp,‘【 Now 】:  ‘. date("Y-m-d H:i:s") ."\n");
20          fclose($fp); 
21          print_r($xml);
22          */
23     }

 

thinkphp5.0 中简单处理微信支付异步通知

上一篇:微信小程序网络通信(一)


下一篇:C++ 在释放指针时,要把指针设置为0