/** * * 撤销订单API接口,Reverse中参数out_trade_no和transaction_id必须填写一个 * appid、mchid、spbill_create_ip、nonce_str不需要填入 * @param Reverse $inputObj * @param int $timeOut * @throws Exception */ public static function reverse($inputObj, $timeOut = 6) { $url = "https://api.mch.weixin.qq.com/secapi/pay/reverse"; //检测必填参数 if (!$inputObj->IsOut_trade_noSet() && !$inputObj->IsTransaction_idSet()) { throw new Exception("撤销订单API接口中,参数out_trade_no和transaction_id必须填写一个!"); } $inputObj->SetAppid(Config::APPID); //公众账号ID $inputObj->SetMch_id(Config::MCHID); //商户号 $inputObj->SetNonce_str(self::getNonceStr()); //随机字符串 $inputObj->SetSign(); //签名 $xml = $inputObj->ToXml(); $startTimeStamp = self::getMillisecond(); //请求开始时间 $response = self::postXmlCurl($xml, $url, true, $timeOut); $result = Results::Init($response); self::reportCostTime($url, $startTimeStamp, $result); //上报请求花费时间 return $result; }
<?php include "C:/xampp/htdocs/xampp/Training/php/myFunction/stringReverseFunction.php"; class Reverse { public $word = ""; function setReverse($sentence) { $result = strReverse($sentence); $this->word = $result; return $this->word; } } $find_reverse = new Reverse(); $find_reverse->setReverse("nirupam"); echo $find_reverse->word;