当前位置:首页 > 微信 > 正文

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

11-26 微信

标签:pen   json   isp   lib   通知   date   code   think   cti   

 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 中简单处理微信支付异步通知

标签:pen   json   isp   lib   通知   date   code   think   cti   

温馨提示: 本文由杰米博客推荐,转载请保留链接: https://www.jmwww.net/weixin/15957.html

博客主人杰米WWW
杰米博客,为大家提供seo以及it方面技巧喜欢的朋友收藏哦!
  • 11365文章总数
  • 2266822访问次数
  • 建站天数
  • 头条文章

    图文推荐

    站长推荐

    友情链接