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


PHP XString::xmlToArray方法代码示例

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


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

示例1: testWrap

 public function testWrap()
 {/*{{{*/
     $dir = dirname(__FILE__);
     $wrapper = new Wrapper;
     $xsltFile = $dir.'/demo.xslt';
     $xmlFile = $dir.'/demo.xml';
     $result = $wrapper->wrap($xsltFile, $xmlFile);
     $expectedRes = '<?xml version="1.0" encoding="gbk"?>
                         <document>
                         <item>
                         <hospitalfacultyname>testÒ½Ôºtest¿Æ</hospitalfacultyname>
                         <url>www.haodf.com</url>
                         </item>
                         </document>';
     $resArray = XString::xmlToArray($result);
     $expectedResArray = XString::xmlToArray($expectedRes);
     $this->assertEquals($expectedResArray, $resArray);
 }/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:18,代码来源:wrapper.php

示例2: testFile

    public function testFile()
    {/*{{{*/
        $maxFileSize = 10*1024*1024;
        $maxItemCount = 10000;
        $configs =  BeanFinder::get('configs');
        $dataPath = $configs->dataPath."complete/";
        
        //文件夹存在
        $this->assertTrue(is_dir($dataPath));

        //取所有文件夹下的文件
        $dirList = XString::listDir($dataPath);

        if ($dirList)
        {
            foreach ($dirList as $dir)
            {
                $fileList = XString::listFile($dataPath.$dir);
                foreach ($fileList as $file)
                {
                    //单个文件不超过10M
                    $this->assertFalse((filesize($file) > $maxFileSize), $file."过大\n");
                }
            }

            foreach ($dirList as $dir)
            {
                $fileList = XString::listFile($dataPath.$dir);
                foreach ($fileList as $file)
                {
                    $xmlData = $xmlHospitalList = $xmlHospital = array();
                    $xmlData = file_get_contents($file);
                    $xmlHospitalList = XString::xmlToArray($xmlData);
                    if (isset($xmlHospitalList['item']) && $xmlHospitalList['item'])
                    {
                        //每个文件数量不超过10000
                        $xmlHospital = array_pop($xmlHospitalList['item']);
                        $this->assertFalse(count($xmlHospital) > $maxItemCount);
                    }
                }
            }
        }
    }/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:43,代码来源:fileformat.php

示例3: __construct

    public function __construct($request, $response) 
    {/*{{{*/
        $ioFaculty = new IOFaculty();
        $this->IOConverter = $ioFaculty->run(IOFaculty::TYPE_XML); 
        $response->confLogPath = PhoneConferenceClient::getInstance()->getConfLogPath();

        $items = '';
        if ($request instanceof Request && CallCenterApiFaculty::SPTYPE_CLOUD != $request->callbacktype)
        {
            $arr = $request->getAllRequest();
            $items = $this->getLogStr($arr);
        }
        else
        {
            $items =  file_get_contents("php://input");
            $items = preg_replace("/<S.* \/>/","",$items);
            $items = $this->getLogStr(XString::xmlToArray($items));
        }
        $this->logTxt .= XDateTime::now()->toString().$items."\n";
        $this->setCallBack($request->callbacktype, $response);
    }/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:21,代码来源:callcentercallbackbasecontroller.php

示例4: xmlData

 private function xmlData($filePath="", $type = 'baidu')
 {/*{{{*/
     $xml = array();
     if ($filePath)
     {
         $xmlData = file_get_contents($filePath);
         $xmlDataList = XString::xmlToArray($xmlData);
         if ($xmlDataList)
         {
             if ($type == 'baidu')
             {
                 $xml = array_pop($xmlDataList['item']);
             }
             elseif ($type == 'soso')
             {
                 $xml = array_pop($xmlDataList['datalist']['item']);
             }
         }
     }
     $this->assertFalse(empty($xml), "没有内容\n");
     return XString::convertEncoding($xml, 'GBK', 'auto');
 }/*}}}*/
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:22,代码来源:datasource.php

示例5: initCallBackData

 public function initCallBackData(array $data, $name)
 {
     /*{{{*/
     $sign = $data["sign"];
     $content = "notify_data=" . $data["notify_data"];
     $res = $this->verify($content, $sign);
     if (false == $res) {
         return $res;
     } else {
         $out_trade_no = $this->getDataForXML($data["notify_data"], '/notify/out_trade_no');
         list($sn, $type) = Pay::explodeSN($out_trade_no);
         Pay::checkNameInValidNames($name);
         $this->sn = $sn;
         $this->name = $name;
         $this->type = Pay::$typeDescs[$type];
         $arrcontent = XString::xmlToArray($data["notify_data"]);
         $arrcontent['name'] = $name;
         $arrcontent = XString::convertEncoding($arrcontent, 'gbk', 'utf8');
         $this->content = $arrcontent;
         $this->total_fee = $this->getDataForXML($data["notify_data"], '/notify/total_fee');
         $this->total_fee = (array) $this->total_fee;
         $this->total_fee = $this->total_fee[0];
         $this->trade_status = $this->getDataForXML($data["notify_data"], '/notify/trade_status');
         $this->trade_status = (array) $this->trade_status;
         $this->trade_status = $this->trade_status[0];
         $this->data = $arrcontent;
         return $this;
     }
 }
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:29,代码来源:wapalipay.php

示例6: initCallBackData

 public function initCallBackData(array $data, $name)
 {
     /*{{{*/
     $waperAlipayFunction = wap_alipay_function::getInstance();
     $out_trade_no = $waperAlipayFunction->getDataForXML($data["notify_data"], '/notify/out_trade_no');
     list($sn, $type) = Pay::explodeSN($out_trade_no);
     Pay::checkNameInValidNames($name);
     $this->sn = $sn;
     $this->name = $name;
     $this->type = Pay::$typeDescs[$type];
     $arrcontent = XString::xmlToArray($data["notify_data"]);
     $arrcontent['name'] = $name;
     $arrcontent = XString::convertEncoding($arrcontent, 'gbk', 'utf8');
     $this->content = $arrcontent;
     $this->total_fee = $waperAlipayFunction->getDataForXML($data["notify_data"], '/notify/total_fee');
     $this->total_fee = (array) $this->total_fee;
     $this->total_fee = $this->total_fee[0];
     $this->trade_status = $waperAlipayFunction->getDataForXML($data["notify_data"], '/notify/trade_status');
     $this->trade_status = (array) $this->trade_status;
     $this->trade_status = $this->trade_status[0];
     $this->data = $arrcontent;
     return $this;
 }
开发者ID:sdgdsffdsfff,项目名称:hdf-client,代码行数:23,代码来源:waperalipay.php


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