本文整理汇总了PHP中xmlToArray函数的典型用法代码示例。如果您正苦于以下问题:PHP xmlToArray函数的具体用法?PHP xmlToArray怎么用?PHP xmlToArray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xmlToArray函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: sendSMSAli
function sendSMSAli($mobile, $mobile_code, $time = '', $mid = '')
{
include "TopSdk.php";
$c = new TopClient();
$c->appkey = "23294546";
//这里填写您申请的appkey
$c->secretKey = "7f5f7a5d562089d01792ac5372f81d08";
//这里填写您申请的secretKey
$req = new AlibabaAliqinFcSmsNumSendRequest();
$req->setExtend("123456");
//填写什么都可以
$req->setSmsType("normal");
//短信类型,不用修改
$req->setSmsFreeSignName("注册验证");
//这里填写短信签名
$req->setSmsParam("{\"code\":\"{$mobile_code}\",\"product\":\"技师达\"}");
//按要求引入变量
$req->setRecNum($mobile);
//接收短信的手机变量
$req->setSmsTemplateCode("SMS_3991033");
//这里填写短信模板编号
$resp = $c->execute($req);
$reArray = xmlToArray($resp);
//返回结果
if (isset($reArray["code"]) && $reArray["code"] > 0) {
return false;
} else {
return true;
}
}
开发者ID:macall,项目名称:baikec_jsd,代码行数:30,代码来源:sms.php
示例2: sendSMSAli
function sendSMSAli($mobile, $mobile_code, $time = '', $mid = '')
{
include "TopSdk.php";
$c = new TopClient();
$c->appkey = "23278568";
//这里填写您申请的appkey
$c->secretKey = "87410133aa8ab0cdfd2ba521209a3793";
//这里填写您申请的secretKey
$req = new AlibabaAliqinFcSmsNumSendRequest();
$req->setExtend("123456");
//填写什么都可以
$req->setSmsType("normal");
//短信类型,不用修改
$req->setSmsFreeSignName("注册验证");
//这里填写短信签名
$req->setSmsParam("{\"code\":\"{$mobile_code}\",\"product\":\"钰盈堂净颜梅\"}");
//按要求引入变量
$req->setRecNum($mobile);
//接收短信的手机变量
$req->setSmsTemplateCode("SMS_2950020");
//这里填写短信模板编号
$resp = $c->execute($req);
$reArray = xmlToArray($resp);
//返回结果
if (isset($reArray["code"]) && $reArray["code"] > 0) {
return false;
} else {
return true;
}
}
开发者ID:macall,项目名称:ldh,代码行数:30,代码来源:sms.php
示例3: xmlToArray
/**
* Create plain PHP associative array from XML.
*
* Example usage:
* $xmlNode = simplexml_load_file('example.xml');
* $arrayData = xmlToArray($xmlNode);
* echo json_encode($arrayData);
*
* @param SimpleXMLElement $xml The root node
* @param array $options Associative array of options
* @return array
* @link http://outlandishideas.co.uk/blog/2012/08/xml-to-json/ More info
* @author Tamlyn Rhodes <http://tamlyn.org>
* @license http://creativecommons.org/publicdomain/mark/1.0/ Public Domain
*/
function xmlToArray($xml, $options = array())
{
$defaults = array('namespaceSeparator' => ':', 'attributePrefix' => '', 'alwaysArray' => array(), 'autoArray' => true, 'textContent' => '$', 'autoText' => true, 'keySearch' => '@', 'keyReplace' => '');
$options = array_merge($defaults, $options);
$namespaces = $xml->getDocNamespaces();
$namespaces[''] = null;
//add base (empty) namespace
//get attributes from all namespaces
$attributesArray = array();
foreach ($namespaces as $prefix => $namespace) {
foreach ($xml->attributes($namespace) as $attributeName => $attribute) {
//replace characters in attribute name
if ($options['keySearch']) {
$attributeName = str_replace($options['keySearch'], $options['keyReplace'], $attributeName);
}
$attributeKey = $options['attributePrefix'] . ($prefix ? $prefix . $options['namespaceSeparator'] : '') . $attributeName;
$attributesArray[$attributeKey] = (string) $attribute;
}
}
//get child nodes from all namespaces
$tagsArray = array();
foreach ($namespaces as $prefix => $namespace) {
foreach ($xml->children($namespace) as $childXml) {
//recurse into child nodes
$childArray = xmlToArray($childXml, $options);
list($childTagName, $childProperties) = each($childArray);
//replace characters in tag name
if ($options['keySearch']) {
$childTagName = str_replace($options['keySearch'], $options['keyReplace'], $childTagName);
}
//add namespace prefix, if any
if ($prefix) {
$childTagName = $prefix . $options['namespaceSeparator'] . $childTagName;
}
if (!isset($tagsArray[$childTagName])) {
//only entry with this key
//test if tags of this type should always be arrays, no matter the element count
$tagsArray[$childTagName] = in_array($childTagName, $options['alwaysArray']) || !$options['autoArray'] ? array($childProperties) : $childProperties;
} elseif (is_array($tagsArray[$childTagName]) && array_keys($tagsArray[$childTagName]) === range(0, count($tagsArray[$childTagName]) - 1)) {
//key already exists and is integer indexed array
$tagsArray[$childTagName][] = $childProperties;
} else {
//key exists so convert to integer indexed array with previous value in position 0
$tagsArray[$childTagName] = array($tagsArray[$childTagName], $childProperties);
}
}
}
//get text content of node
$textContentArray = array();
$plainText = trim((string) $xml);
if ($plainText !== '') {
$textContentArray[$options['textContent']] = $plainText;
}
//stick it all together
$propertiesArray = !$options['autoText'] || $attributesArray || $tagsArray || $plainText === '' ? array_merge($attributesArray, $tagsArray, $textContentArray) : $plainText;
//return node as array
return array($xml->getName() => $propertiesArray);
}
开发者ID:salvacam,项目名称:killallradioapp,代码行数:73,代码来源:xml2json.php
示例4: notify
public function notify()
{
//使用通用通知接口
$notify = new \Notify_pub();
//存储微信的回调
$xml = $GLOBALS['HTTP_RAW_POST_DATA'];
$notify->saveData($xml);
//验证签名,并回应微信。
//对后台通知交互时,如果微信收到商户的应答不是成功或超时,微信认为通知失败,
//微信会通过一定的策略(如30分钟共8次)定期重新发起通知,
//尽可能提高通知的成功率,但微信不保证通知最终能成功。
if ($notify->checkSign() == FALSE) {
$notify->setReturnParameter("return_code", "FAIL");
//返回状态码
$notify->setReturnParameter("return_msg", "签名失败");
//返回信息
} else {
$notify->setReturnParameter("return_code", "SUCCESS");
//设置返回码
}
$returnXml = $notify->returnXml();
echo $returnXml;
//==商户根据实际情况设置相应的处理流程,此处仅作举例=======
//以log文件形式记录回调信息
$log_ = new \Log_();
$time = date('Ymd', time());
$log_name = './logs/pay/jsAPI/' . $time . "notify_url.log";
$log_->log_result($log_name, "【接收到的notify通知】:\n" . $xml . "\n");
if ($notify->checkSign() == TRUE) {
if ($notify->data["return_code"] == "FAIL") {
//此处应该更新一下订单状态,商户自行增删操作
$log_->log_result($log_name, "【通信出错】:\n" . $xml . "\n");
//推送信息给用户
} elseif ($notify->data["result_code"] == "FAIL") {
//此处应该更新一下订单状态,商户自行增删操作
$log_->log_result($log_name, "【业务出错】:\n" . $xml . "\n");
} else {
$log_->log_result($log_name, "【业务成功】:\n\r\n");
//以上是业务代码
$jsAPInotify = D('JPN');
$object = xmlToArray($xml);
$res = $jsAPInotify->jsAPINotifyUpO($object);
$xml = "\n <xml>\n <return_code><![CDATA[" . $res . "]]></return_code>\n <return_msg><![CDATA[ITS OVER]]></return_msg>\n </xml>\n ";
exit($xml);
}
}
}
开发者ID:tearys,项目名称:lucky,代码行数:47,代码来源:notify_url.php
示例5: convertXMLtoArr
public static function convertXMLtoArr($xml, $root = true)
{
if (!$xml->children()) {
return (string) $xml;
}
$array = array();
foreach ($xml->children() as $element => $node) {
$totalElement = count($xml->{$element});
if (!isset($array[$element])) {
$array[$element] = "";
}
// Has attributes
if ($attributes = $node->attributes()) {
$data = array('attributes' => array(), 'value' => count($node) > 0 ? xmlToArray($node, false) : (string) $node);
foreach ($attributes as $attr => $value) {
$data['attributes'][$attr] = (string) $value;
}
if ($totalElement > 1) {
$array[$element][] = $data;
} else {
$array[$element] = $data;
}
// Just a value
} else {
if ($totalElement > 1) {
$array[$element][] = self::convertXMLtoArr($node, false);
} else {
$array[$element] = self::convertXMLtoArr($node, false);
}
}
}
if ($root) {
return array($xml->getName() => $array);
} else {
return $array;
}
}
开发者ID:jpleachon,项目名称:Data-PH,代码行数:37,代码来源:class.wdttools.php
示例6: array
$xml_parser = array();
$orders_created_collection = array();
foreach ($files as $file) {
$xmlfilename = $file_path . $file['filename'];
if (in_array($jng_sp_id, $xmlwithgpg)) {
$xmlfilename = str_replace('.gpg', '', $xmlfilename);
}
$xmlfile = file_get_contents($xmlfilename);
if (file_exists($xmlfilename)) {
$import_status = true;
$import_date = date('Y-m-d H:i:s');
if ($jng_sp_id == '2') {
///////////////
// Otto DE //
///////////////
$arr_xml = xmlToArray($xmlfile);
$OrderTags = isset($arr_xml["ottopartner"]["Orders"]['Order']['order-no']) ? $arr_xml["ottopartner"]["Orders"] : $arr_xml["ottopartner"]["Orders"]['Order'];
$n_orders = count($OrderTags);
if ($n_orders > 0) {
foreach ($OrderTags as $sets_of_order) {
$order = array();
$order['jng_sp_id'] = $jng_sp_id;
$order['xml_file'] = basename($xmlfilename);
$order['xml_date'] = 'null';
$order['iln_jng'] = 'null';
$order['iln_sp'] = 'null';
$order['sp_jng_id'] = $arr_xml["ottopartner"]["LKZ"]["value"];
$order['order_date'] = str_replace("T", " ", $sets_of_order["creation-date"]["value"]);
$dateonly = date('Y-m-d', strtotime($order['order_date']));
if (!isset($daily_counter[$dateonly])) {
$daily_counter[$dateonly] = $class_jo->nextDailyCounter($jng_sp_id, $dateonly);
开发者ID:blasiuscosa,项目名称:manobo-2008,代码行数:31,代码来源:sp-orders-generator.php
示例7: while
<?php
require_once 'funciones.php';
$url = "http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml";
$result = 1;
while ($result == 1) {
$xmlNode = simplexml_load_file($url);
$arrayData = xmlToArray($xmlNode);
$result = saveCurrency($arrayData['Envelope']['Cube']['Cube']['Cube']);
usleep(1200000000);
}
开发者ID:nmcantorp,项目名称:AppIO,代码行数:11,代码来源:actualizar_currency.php
示例8: refund
/**
* 退款
* @param $refund 退款申请记录
* @param $order 订单
*/
function refund($refund, $order)
{
$http = http::getInstance();
$account = new \stdClass();
$account->transOut = $this->_system->get('splitpartner', 'alipay');
$account->amount = $this->_system->get('splitrate', 'alipay') * $refund['money'];
$account->currency = 'CNY';
$split_fund_info = array($account);
$data = array('service' => 'forex_refund', 'partner' => $this->_system->get('partner', 'alipay'), '_input_charset' => $this->_config['input_charset'], 'sign_type' => $this->_config['sign_type'], 'notify_url' => ($http->isHttps() ? 'https://' : 'http://') . $http->host() . '/gateway/alipay/notify.php', 'out_return_no' => $refund['refundno'], 'out_trade_no' => $order['orderno'], 'return_rmb_amount' => $refund['money'], 'currency' => 'EUR', 'gmt_return' => date("YmdHis", $refund['time']), 'reason' => $refund['reason'], 'product_code' => 'NEW_WAP_OVERSEAS_SELLER', 'split_fund_info' => json_encode($split_fund_info));
if ($order['client'] == 'web') {
$data['product_code'] = 'NEW_OVERSEAS_SELLER';
}
$data = $this->trade($data);
$response = file_get_contents($this->_config['gateway_url'] . '?' . http_build_query($data));
$response = xmlToArray($response);
return $response;
}
开发者ID:jin123456bat,项目名称:home,代码行数:22,代码来源:alipay_gateway.php
示例9: sleep
if (($mode_xml || $mode_cxml) && !$mode_server && !$mode_output) {
$trigger_wait_message = true;
}
}
// END IF
}
// END IF
if ($APP['ms']->kind != "no-messaging" && !$messaging_complete) {
// WAIT FOR MESSAGE QUEUE RESPONSE
$message = $new_job_id->receive("replyfrom_" . $selected_job_server_name);
$all_messages .= $message . "<br/>\n";
if (($message . "" == "NULL" || strlen($message . "") == 0) && $cnt < 15) {
sleep(1);
continue;
}
$message_xml = xmlToArray(simplexml_load_string($message));
$collected_job_id = new job_id_user();
$collected_job_id->fromobjectxml($message_xml);
if ($collected_job_id->id == $id_submitted_job) {
$new_job_id->fromobjectxml($message_xml);
$messaging_complete = True;
} else {
$all_messages .= "received a wrong message: " . htmlspecialchars($message);
// we collected a message from anoth/er job - re-post the message to the queue so we don't end up stealing other jobs' responses
$collected_job_id->send("replyfrom_" . $selected_job_server_name, $message);
}
} else {
$new_job_id->get_from_hashrange($u->id_user, $new_job_id->id);
}
if ($new_job_id->id_status != 'running' && $new_job_id->id_status != 'new' && $new_job_id->id_status != 'paused') {
// JOB IS DONE
开发者ID:hisapi,项目名称:his,代码行数:31,代码来源:index.php
示例10: simplexml_load_string
<?php
/*
Returns the JSON-encoded data to the caller.
*/
// Load function that converts a simple XML object into an array.
require_once 'xml-to-array.php';
// Convert the string into a simple XML document.
$response_xml = simplexml_load_string($response_raw);
// Convert the simple XML document to a PHP array.
$response_array = xmlToArray($response_xml);
// JSON encode the array.
$response_json = json_encode($response_array);
// Set HTTP status code to 200 ("OK").
header('Status: 200', TRUE, 200);
// Return the result.
echo $response_json;
开发者ID:timdietrich,项目名称:fmeasyapi,代码行数:18,代码来源:response-return.php
示例11: str_replace
}
$this_http = "http";
if (isset($_SERVER['HTTPS'])) {
if ($_SERVER['HTTPS'] == "on") {
$this_http = "https";
}
}
if (isset($_SERVER["HTTP_X_FORWARDED_PROTO"])) {
if ($_SERVER["HTTP_X_FORWARDED_PROTO"] == "https") {
$this_http = "https";
}
}
$sample_config = str_replace("<uri value=\"{uri}\"/>", "<uri value=\"{$this_server_url}\"/>", $sample_config);
// $sample_config is now an xml representation of the settings page
// convert to php code
$sample_config_xml_array = xmlToArray(simplexml_load_string($sample_config));
$sample_config = "<?php\n";
$sample_config .= "\$" . "settings=";
$sample_config .= var_export($sample_config_xml_array, true) . ";";
$sample_config .= "\n";
$sample_config .= "\$GLOBALS['settings']=\$" . "settings;\n";
$sample_config .= "?" . ">";
$sample_config = trim($sample_config);
if (file_put_contents($BIN_DIR . $PATH_SEPERATOR . "his-config.php", $sample_config) === FALSE) {
$FILE_WRITE = false;
} else {
$FILE_WRITE = true;
}
} else {
$FILE_WRITE = true;
}
开发者ID:hisapi,项目名称:his,代码行数:31,代码来源:install.php
示例12: getOrderStu
echo '支付失败,错误代码' . $dataArray['err_code'] . ':' . $dataArray['err_code'] . $dataArray['err_code_des'];
}
} else {
echo $dataArray['return_msg'];
exit;
}
echo $dataJson;
exit;
} else {
echo getOrderStu($inf['stu']);
}
}
if (isset($GLOBALS["HTTP_RAW_POST_DATA"])) {
$tmpmsg = array('touser' => $to, 'template_id' => 'oMhzLlRCMJ_vXQKQL9Yx12DsG8fXlIUzcz0qz4kb9SI', 'url' => 'http://www.qq.com', 'data' => array('first' => array('value' => '交易成功'), 'product' => array('value' => '测试商品1'), 'price' => array('value' => '1988.00'), 'time' => array('value' => '1月9日16:00'), 'remark' => array('value' => '欢迎再次选购')));
$error = array('return_code' => 'SUCCESS', 'return_msg' => 'OK');
$responseData = xmlToArray($GLOBALS["HTTP_RAW_POST_DATA"]);
// mylog(getArrayInf($responseData));
if ('SUCCESS' == $responseData['return_code']) {
if ('SUCCESS' == $responseData['result_code']) {
if (signVerify($responseData)) {
include_once '../wechat/serveManager.php';
$orderId = $responseData['out_trade_no'];
pdoUpdate('order_tbl', array('stu' => "1"), array('id' => $orderId));
$payChkArray = array('first' => array('value' => '您在阿诗顿商城的网购订单已支付成功:'), 'orderno' => array('value' => $orderId, 'color' => '#0000ff'), 'amount' => array('value' => '¥' . $responseData['total_fee'] / 100, 'color' => '#0000ff'), 'remark' => array('value' => '商城即将安排发货,请留意物流通知'));
$re = sendTemplateMsg($responseData['openid'], $template_key_order, '', $payChkArray);
} else {
}
} else {
}
} else {
}
开发者ID:ldong728,项目名称:ashtonmall,代码行数:31,代码来源:pay.php
示例13: compareResults
function compareResults($resultNew, $resultOld)
{
$resultNew = normalizeResultBuffer($resultNew);
$resultOld = normalizeResultBuffer($resultOld);
if ($resultNew == $resultOld) {
return array();
}
$resultNew = xmlToArray($resultNew);
$resultOld = xmlToArray($resultOld);
if (!$resultNew && !$resultOld) {
return array('failed to parse both XMLs');
}
if (!$resultNew) {
return array('failed to parse new XML');
}
if (!$resultOld) {
return array('failed to parse old XML');
}
return compareArrays($resultNew, $resultOld, "");
}
开发者ID:DBezemer,项目名称:server,代码行数:20,代码来源:compatCheck.php
示例14: Settings_Storage_Adapter
include_once "model.storage.php";
$fs = new Settings_Storage_Adapter($settings);
$fs = $fs->storage;
$APP['fs'] = $fs;
if (!$fs->connect()) {
include "templates/existsmessage.php";
exit;
}
include_once "model.message.php";
$ms = new Settings_Message_Adapter($settings);
$ms = $ms->messenger;
$APP['ms'] = $ms;
}
/// SERVICES
$services_file = $BIN_DIR . $PATH_SEPERATOR . "services.xml";
$service_doc = xmlToArray(simplexml_load_file($services_file));
$services = array();
foreach ($service_doc as $services_list) {
foreach ($services_list as $service) {
$new_service = new Service($service);
$services[] = $new_service;
}
}
//$GLOBALS['settings']=$settings;
$APP['services'] = $services;
$GLOBALS['APP'] = $APP;
global $APP;
class his
{
public $obj_key_type = 'hash';
public $obj_version;
开发者ID:hisapi,项目名称:his,代码行数:31,代码来源:model.classes.php
示例15: notify
public function notify()
{
$rsv_data = $GLOBALS['HTTP_RAW_POST_DATA'];
$result = xmlToArray($rsv_data);
$map["appid"] = $result["appid"];
$map["mchid"] = $result["mch_id"];
$info = M('member_public')->where($map)->find();
//获取公众号信息,jsApiPay初始化参数
$this->options['appid'] = $info['appid'];
$this->options['mchid'] = $info['mchid'];
$this->options['mchkey'] = $info['mchkey'];
$this->options['secret'] = $info['secret'];
$this->options['notify_url'] = $info['notify_url'];
$this->wxpaycfg = new WxPayConfig($this->options);
//发送模板消息
$TMArray = array("touser" => $result["openid"], "template_id" => "diW6jm5hBwemeoDF0FZdU2agSZ9kydje22YJIC0gVMo", "url" => "http://test.uctoo.com/index.php?s=/home/addons/execute/Ucuser/Ucuser/index/mp_id/107.html", "topcolor" => "#FF0000", "data" => array("name" => array("value" => "优创智投", "color" => "#173177"), "remark" => array("value" => "今天", "color" => "#173177")));
$options['appid'] = $info['appid'];
//初始化options信息
$options['appsecret'] = $info['secret'];
$options['encodingaeskey'] = $info['encodingaeskey'];
$weObj = new TPWechat($options);
$res = $weObj->sendTemplateMessage($TMArray);
//回复公众平台支付结果
$notify = new PayNotifyCallBackController($this->wxpaycfg);
//
$notify->Handle(false);
//处理业务逻辑
}
开发者ID:fishling,项目名称:chatPro,代码行数:28,代码来源:IndexController.class.php
示例16: xmlToArray
function xmlToArray($xml, $root = true)
{
if (!$xml->children()) {
return (string) $xml;
}
$array = array();
foreach ($xml->children() as $element => $node) {
$totalElement = count($xml->{$element});
if (!isset($array[$element])) {
$array[$element] = "";
}
// Has attributes
if ($attributes = $node->attributes()) {
$data = array('attributes' => array());
if (!count($node->children())) {
$data['value'] = (string) $node;
} else {
$data = array_merge($data, xmlToArray($node, false));
}
foreach ($attributes as $attr => $value) {
$data['attributes'][$attr] = (string) $value;
}
if ($totalElement > 1) {
$array[$element][] = $data;
} else {
$array[$element] = $data;
}
// Just a value
} else {
if ($totalElement > 1) {
$array[$element][] = xmlToArray($node, false);
} else {
$array[$element] = xmlToArray($node, false);
}
}
}
if ($root) {
return array($xml->getName() => $array);
} else {
return $array;
}
}
开发者ID:Covert-Inferno,项目名称:prohd,代码行数:42,代码来源:EVEXMLData.php
示例17: xmlToArray
function xmlToArray($xml)
{
$array = json_decode(json_encode($xml), TRUE);
if ($array) {
if (count(array_slice($array, 0)) > 0) {
foreach (array_slice($array, 0) as $key => $value) {
if ($value === false || $value === "" || $value === NULL) {
$array[$key] = NULL;
// NULL
} elseif (is_array($value)) {
$array[$key] = xmlToArray($value);
}
}
}
}
return $array;
}
开发者ID:hisapi,项目名称:his,代码行数:17,代码来源:utility.functions.php
示例18: importOttoB2BOrderFromXML
function importOttoB2BOrderFromXML($xml_uploaded_file)
{
$import_time = date('Y-m-d H:i:s');
$xmlfile = file_get_contents($xml_uploaded_file['tmp_name']);
$xmlcontent = mb_convert_encoding($xmlfile, 'UTF-8', 'ISO-8859-1');
$arr_xml = xmlToArray($xmlcontent);
return importOttoB2BOrderFromArray($arr_xml['OttoB2B:Order'], $xml_uploaded_file['name'], $import_time);
}
开发者ID:blasiuscosa,项目名称:manobo-2008,代码行数:8,代码来源:sp-orders-ottob2b.php
示例19: alarmnotify
public function alarmnotify()
{
$post_data = $GLOBALS['HTTP_RAW_POST_DATA'];
\Think\Log::record("alarmnotify" . $post_data);
$result = xmlToArray($post_data);
$resp = true;
$respdata["return_code"] = "SUCCESS";
$respdata["return_msg"] = "";
$map["appid"] = $result["appid"];
$map["mch_id"] = $result["mch_id"];
$map["openid"] = $result["openid"];
$map["out_trade_no"] = $result["out_trade_no"];
// while (true) { //alarmnotify和orderpaid调用时序无保证,未将历史订单的支付流水写入订单表就一直循环
$orderdata = M("mall_order_his")->where($map)->order('id DESC')->find();
if ($orderdata["id"] != "") {
//已经记录过的订单数据
$map1["openid"] = $orderdata["openid"];
$map1["dcnum"] = $orderdata["out_trade_no"];
//TODO:进行安全校验,修订订单支付状态
$dddata = M("ml_mall_order")->where($map1)->order('id asc')->find();
if ($dddata["statekz"] == "0" || $dddata["statekz"] == "1") {
//未支付,设置为已支付,没有记录交易流水的将交易流水写入订单表
M("mall_order")->where($map1)->save(array("statekz" => 1, "transaction_id" => $orderdata["transaction_id"]));
}
if ($resp == true) {
//根据不同的错误设置返回数据
return arrayToXml($respdata);
} else {
return arrayToXml($respdata);
}
} else {
$order = M("mall_order_his");
/* 保存附件 */
if ($order->create($result) && $order->add()) {
$resp = true;
} else {
$resp = false;
$respdata["return_msg"] = "保存订单数据错误";
}
}
}
开发者ID:fishling,项目名称:chatPro,代码行数:41,代码来源:JssdkController.class.php
示例20: xmlToArray
function xmlToArray(SimpleXMLElement $xml, $skipattributes = false)
{
$return = array();
$_value = trim((string) $xml);
if (!strlen($_value)) {
$_value = null;
}
if ($_value !== null) {
$return = $_value;
}
if (!$skipattributes) {
$attributes = array();
foreach ($xml->attributes() as $name => $value) {
$attributes[$name] = trim($value);
}
if ($attributes) {
$return = array_merge($return, $attributes);
}
}
$children = array();
$first = true;
$skipattributes = false;
foreach ($xml->children() as $elementName => $child) {
if ($elementName == 'rowset') {
$elementName = (string) $child->attributes()->name;
$skipattributes = true;
}
if ($elementName == 'row') {
$value = xmlToArray($child, $skipattributes);
$children[] = $value;
continue;
}
$value = xmlToArray($child, $skipattributes);
if (isset($children[$elementName])) {
if (is_array($children[$elementName])) {
if ($first) {
$temp = $children[$elementName];
unset($children[$elementName]);
$children[$elementName][] = $temp;
$first = false;
}
$children[$elementName][] = $value;
} else {
$children[$elementName] = array($children[$elementName], $value);
}
} else {
$children[$elementName] = $value;
}
}
if ($children) {
$return = array_merge($return, $children);
}
return $return;
}
开发者ID:biow0lf,项目名称:evedev-kb,代码行数:54,代码来源:update.php
注:本文中的xmlToArray函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论