当前位置: 首页>>代码示例>>PHP>>正文


PHP COM::init方法代码示例

本文整理汇总了PHP中COM::init方法的典型用法代码示例。如果您正苦于以下问题:PHP COM::init方法的具体用法?PHP COM::init怎么用?PHP COM::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在COM的用法示例。


在下文中一共展示了COM::init方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: callback

 function callback($in, &$paymentId, &$money, &$message, &$tradeno)
 {
     $paymentId = $in['merVAR'];
     if (is_dir(dirname(__FILE__) . "/../../../home/upload/icbc/")) {
         $realpath = dirname(__FILE__) . "/../../../home/upload/icbc/";
     } elseif (is_dir(dirname(__FILE__) . "/../../../cert/icbc/")) {
         $realpath = dirname(__FILE__) . "/../../../cert/icbc/";
     }
     $merId = $this->getConf($paymentId, 'member_id');
     $icbc = $realPath . $this->getConf($paymentId, 'icbcFile');
     $cert = $realPath . $this->getConf($paymentId, 'certFile');
     $key = $realPath . $this->getConf($paymentId, 'keyFile');
     $keyPass = $this->getConf($paymentId, 'keyPass');
     $notifyData = base64_decode($in['notifyData']);
     if (strtoupper(substr(PHP_OS, 0, 3)) == "WIN") {
         $bb = new COM('ICBCEBANKUTIL.B2CUtil');
         $bb->init($icbc, $cert, $key, $keyPass);
         $isok = $bb->verifySignC($notifyData, strlen($notifyData), $in['signMsg'], strlen($in['signMsg']));
     } else {
         $cmd = "/bin/icbc_verify '{$icbcpubcert}' '{$notifyData}' '{$signMsg}'";
         $handle = popen($cmd, 'r');
         $isok = fread($handle, 8);
         pclose($handle);
     }
     if ($isok == 0) {
         preg_match("/\\<amount\\>(.*)\\<\\/amount\\>.+\\<TranSerialNo\\>(.*)\\<\\/TranSerialNo\\>.+\\<tranStat\\>(.*)\\<\\/tranStat\\>/i", $notifyData, $rnt);
         $money = $rnt[1] / 100;
         $tradeno = $rnt[2];
         if ($rnt[3] == 1) {
             $message = "支付成功!";
             return PAY_SUCCESS;
         } else {
             $message = "支付失败!";
             return PAY_FAILED;
         }
     } else {
         $message = "验证签名错误!";
         return PAY_ERROR;
     }
 }
开发者ID:noikiy,项目名称:cxe,代码行数:40,代码来源:pay_icbc.php

示例2: foreach

    $aREQ["Language"] = 'ZH_CN';
    echo "<form action=?action=go method=post target='go'><table>";
    foreach ($aREQ as $k => $v) {
        echo "<tr><td>{$k}</td><td><input name=\"{$k}\" type=\"text\" value=\"{$v}\"  size='100'/></td></tr>";
    }
    echo "<tr><td clospan=2><input type=submit value=submit></td></tr><table>";
    echo "</form>";
}
if ($action == 'go') {
    //xml
    $tranData = "<?xml version=\"1.0\" encoding=\"GBK\" standalone=\"no\"?><B2CReq><interfaceName>" . $_REQUEST["interfaceName"] . "</interfaceName><interfaceVersion>" . $_REQUEST["interfaceVersion"] . "</interfaceVersion><orderInfo><orderDate>" . $_REQUEST["orderDate"] . "</orderDate><curType>" . $_REQUEST["curType"] . "</curType><merID>" . $_REQUEST["merID"] . "</merID><subOrderInfoList><subOrderInfo><orderid>" . $_REQUEST["orderid"] . "</orderid><amount>" . $_REQUEST["amount"] . "</amount><installmentTimes>" . $_REQUEST["installmentTimes"] . "</installmentTimes><merAcct>" . $_REQUEST["merAcct"] . "</merAcct><goodsID>" . $_REQUEST["goodsID"] . "</goodsID><goodsName>" . $_REQUEST["goodsName"] . "</goodsName><goodsNum>" . $_REQUEST["goodsNum"] . "</goodsNum><carriageAmt>" . $_REQUEST["carriageAmt"] . "</carriageAmt></subOrderInfo></subOrderInfoList></orderInfo><custom><verifyJoinFlag>" . $_REQUEST["verifyJoinFlag"] . "</verifyJoinFlag><Language>" . $_REQUEST["Language"] . "</Language></custom><message><merHint>" . $_REQUEST["merHint"] . "</merHint><remark1>" . $_REQUEST["remark1"] . "</remark1><remark2>" . $_REQUEST["remark2"] . "</remark2><merURL>" . $_REQUEST["merURL"] . "</merURL><merVAR>" . $_REQUEST["merVAR"] . "</merVAR></message></B2CReq>";
    //商户签名数据BASE64编码
    if (strtoupper(substr(PHP_OS, 0, 3)) == "WIN") {
        //windows系统,请先注册ICBCEBankUtil.dll,这个文件在文档包中的asp文件夹中
        $icbcutil = new COM("ICBCEBANKUTIL.B2CUtil");
        $rc = $icbcutil->init(MERCCERTFILE, MERCCERTFILE, MERCRRVIFILE, MERCPASSWORD);
        $merSignMsg = $icbcutil->signC($tranData, strlen($tranData));
    } else {
        $cmd = "/bin/icbc_sign '" . MERCRRVIFILE . "' '" . MERCPASSWORD . "' '{$tranData}'";
        $handle = popen($cmd, 'r');
        $merSignMsg = fread($handle, 2096);
        pclose($handle);
    }
    //
    $fp = fopen(MERCCERTFILE, "rb");
    $merCert = fread($fp, filesize(MERCCERTFILE));
    $merCert = base64_encode($merCert);
    fclose($fp);
    //
    $tranData = base64_encode($tranData);
    //
开发者ID:dalinhuang,项目名称:shopexts,代码行数:31,代码来源:index.php


注:本文中的COM::init方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。