public function feedback() { //kernel::log('sdadasd1321331');exit; // header('Content-Type:text/xml'); $postdata = file_get_contents("php://input"); // $postObj = simplexml_load_string ( $postdata, 'SimpleXMLElement', LIBXML_NOCDATA ); // $openId = $postObj->OpenId; // $AppId = $postObj->AppId; // $IsSubscribe = $postObj->IsSubscribe; // $ProductId = $postObj->ProductId;//订单ID // $TimeStamp = $postObj->TimeStamp; // $NonceStr = $postObj->NonceStr; // $AppSignature = $postObj->AppSignature; // $SignMethod = $postObj->SignMethod; // $postStr = $GLOBALS["HTTP_RAW_POST_DATA"]; // // // $postArray = kernel::single('site_utility_xml')->xml2array($postStr); // $postData['weixin_postdata'] = $postArray['xml']; // $AppId=$postData['appid']; // $openId=$postData['openid']; // $IsSubscribe=$postData['is_subscribe']; // $TimeStamp=$postData['timestamp']; // $AppSignature=$postData['appsignature']; // $NonceStr=$postData['nonce_str']; // $ProductId=$postData['product_id']; $fh = fopen('api.txt', 'a'); // foreach ($postData as $k=>$v){ // $str.=$k.':'.$v.'||'; // } fwrite($fh, $postdata . 'weixinzhifu'); fclose($fh); exit; $orderMdl = app::get('b2c')->model('orders'); $orderItemMdl = app::get('b2c')->model('order_items'); $orders = $orderMdl->getList('total_amount', array('order_id' => $ProductId)); $total_fee = $orders[0]['total_amount']; $order_items = $orderItemMdl->getList('name', array('order_id' => $ProductId)); $body = ''; foreach ($order_items as $item) { $body .= $item['name'] . ','; } $data = array("AppId" => $AppId, "Package" => $this->getPackage('商品测试', 100, '201311291504302501231'), "TimeStamp" => strtotime(), "NonceStr" => $NonceStr, "RetCode" => 0, "RetErrMsg" => "正确返回", "AppSignature" => $AppSignature, "SignMethod" => "sha1"); echo weixin_util::arrayToXml($data); }