當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Wechat::getXmlArray方法代碼示例

本文整理匯總了PHP中Wechat::getXmlArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP Wechat::getXmlArray方法的具體用法?PHP Wechat::getXmlArray怎麽用?PHP Wechat::getXmlArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Wechat的用法示例。


在下文中一共展示了Wechat::getXmlArray方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Wechat

<?php

/**
 * 標記客戶的投訴處理狀態
 * @author www.linauror.com
 * @copyright 2014
 */
include 'config.php';
include 'lib.php';
$wechat = new Wechat();
$data = $wechat->getXmlArray();
// 具體參數可以查看文檔
// openid 與 feedback參數都可以從數據庫中得到
$result = file_get_contents('http://api.weixin.qq.com/cgi-bin/pay/delivernotify?access_token=' . $wechat->getAccessToken() . '&openid=' . $openid . '&feedbackid=' . $feedbackid);
$result = json_decode($result, true);
if ($result['errcode'] == 0) {
    echo 'success';
} else {
    print_r($result);
}
開發者ID:dlpc,項目名稱:weixinshop,代碼行數:20,代碼來源:updatefeedback.php

示例2: Wechat

<?php

define('IN_ECS', true);
require '../includes/init.php';
require '../includes/lib_order.php';
include_once '../includes/lib_payment.php';
//獲取post數據
include_once '../includes/modules/payment/Wechat.php';
$wechat = new Wechat();
$post = $wechat->getXmlArray();
addLog($post, 6);
$oid = intval($post['productid']);
$order = $db->getRow("SELECT * FROM " . $GLOBALS['ecs']->table('order_info') . " WHERE order_id = {$oid}");
//if($order['pay_status'] == 2) exit('is payed');
if ($order['order_amount'] > 0) {
    $payment = payment_info($order['pay_id']);
    include_once '../includes/modules/payment/' . $payment['pay_code'] . '.php';
    $pay_obj = new $payment['pay_code']();
    $payment = unserialize_config($payment['pay_config']);
    if ($post['appid'] == $payment['appId']) {
        define(APPID, $payment['appId']);
        define(APPKEY, $payment['paySignKey']);
        define(SIGNTYPE, "sha1");
        define(PARTNERKEY, $payment['partnerKey']);
        define(APPSERCERT, $payment['appSecret']);
        include_once "../includes/modules/payment/weixin/WxPayHelper.php";
        $wxPayHelper = new WxPayHelper();
        $url = return_url('weixin');
        $wxPayHelper->setParameter("bank_type", "WX");
        $wxPayHelper->setParameter("body", $order['order_sn']);
        $wxPayHelper->setParameter("partner", $payment['partnerId']);
開發者ID:firsteam,項目名稱:falcons,代碼行數:31,代碼來源:natpay.php

示例3: fopen

// 官方文檔所說的post是接收不到參數的,實際上要用get才行
// 寫入文件
$filename = 'notify_back_before.txt';
$fh = fopen($filename, "w");
fwrite($fh, "異步通知:\r\n");
foreach ($array as $key => $value) {
    fwrite($fh, $key . "=" . $value . "&");
}
fwrite($fh, "\r\n\r\n");
//關閉文件
fclose($fh);
//$verifyNotify = $wechat->verifyNotify($array, $config); // 驗證通知
//if ($verifyNotify) {
if ($array['trade_state'] == 0) {
    //成功支付
    $array += $wechat->getXmlArray();
    // 再獲取xml數據
    // 結果已經獲取到了 下麵可以更新數據庫支付狀態等操作了 也可以使用訂單查詢接口來查詢是否支付成功
    // 寫入文件
    $filename = 'notify_back_after.txt';
    $fh = fopen($filename, "w");
    fwrite($fh, "異步通知:\r\n");
    foreach ($array as $key => $value) {
        fwrite($fh, $key . "=" . $value . "&");
    }
    fwrite($fh, "\r\n\r\n");
    //關閉文件
    fclose($fh);
    $mysqli = new mysqli($arr["DB_HOST"], $arr["DB_USER"], $arr["DB_PWD"], $arr["DB_NAME"], $arr["DB_PORT"]);
    //記錄支付日誌
    $query = "insert into " . $arr["DB_PREFIX"] . "wxpay_history(`sign_type`,`service_version`,`input_charset`," . "`sign`,`sign_key_index`,`trade_mode`,`trade_state`,`pay_info`,`partner`,`bank_type`,`bank_billno`," . "`total_fee`,`fee_type`,`notify_id`,`transaction_id`,`out_trade_no`,`attach`,`time_end`,`transport_fee`," . "`product_fee`,`discount`,`buyer_alias`,`openid`,`appid`,`issubscribe`,`timestamp`,`noncestr`,`appsignature`,`signmethod`)" . " values ( '" . $array['sign_type'] . "', '" . $array['service_version'] . "', '" . $array['input_charset'] . "', '" . $array['sign'] . "', '" . $array['sign_key_index'] . "', '" . $array['trade_mode'] . "', '" . $array['trade_state'] . "', '" . $array['pay_info'] . "', '" . $array['partner'] . "', '" . $array['bank_type'] . "', '" . $array['bank_billno'] . "', '" . $array['total_fee'] . "', '" . $array['fee_type'] . "', '" . $array['notify_id'] . "', '" . $array['transaction_id'] . "', '" . $array['out_trade_no'] . "', '" . $array['attach'] . "', '" . $array['time_end'] . "', '" . $array['transport_fee'] . "', '" . $array['product_fee'] . "', '" . $array['discount'] . "', '" . $array['buyer_alias'] . "', '" . $array['openid'] . "', '" . $array['appid'] . "', '" . $array['issubscribe'] . "', '" . $array['timestamp'] . "', '" . $array['noncestr'] . "', '" . $array['appsignature'] . "', '" . $array['signmethod'] . "')";
開發者ID:dlpc,項目名稱:wxshoppingmall,代碼行數:31,代碼來源:notify_url.php

示例4: strval

$partnerkey = strval($row['partnerkey']);
$signkey = strval($row['signkey']);
$partner = strval($row['partnerid']);
$config = array('appId' => $appid, 'appSecret' => $secret, 'paySignKey' => $signkey, 'partnerId' => $partner, 'partnerKey' => $partnerkey);
$wechat = new Wechat();
$array2 = $_GET;
/*$strget="get:";
foreach ($array2 as $k2 => $v2) {
	$strget.= $k2."=".$v2."&";
}
$wechat->log_result($strget);
*/
$verifyNotify = $array2['notify_id'];
//驗證通知
if ($verifyNotify) {
    $array2['xml'] = $wechat->getXmlArray();
    //獲取xml數據
    //$array += $wechat->getXmlArray(); // 再獲取xml數據
    //$array2 += $wechat->getXmlArray(); // 再獲取xml數據
    $wxorder = serialize($array2);
    // 結果已經獲取到了 下麵可以更新數據庫支付狀態等操作了 也可以使用訂單查詢接口來查詢是否支付成功
    //$wechat->log_result($array);
    $out_trade_no = $array2['out_trade_no'];
    //商戶訂單號
    // echo $out_trade_no;exit;
    // $notify_id= $array['notify_id'];//通知id
    $trade_state = $array2['trade_state'];
    //交易狀態
    if ($trade_state == 0) {
        $sql = "update " . $arr['DB_PREFIX'] . "item_order set status=2,support_time=" . time() . ",paytype='wxpay' where orderId='" . $out_trade_no . "'";
        mysql_query($sql, $conn);
開發者ID:bgp1984,項目名稱:WeixinShop,代碼行數:31,代碼來源:notifyurl.php


注:本文中的Wechat::getXmlArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。