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


PHP XString::listFile方法代碼示例

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


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

示例1: getDataInfo

 private function getDataInfo($dataArray)
 {/*{{{*/
     if(is_array($dataArray) && !empty($dataArray))
     {
         foreach($dataArray as $data)
         {
             $dataDir = $this->dataPath.$data.'/';
             $res[$data] = XString::listFile($dataDir);
         }
         return $res;
     }
     return null;
 }/*}}}*/
開發者ID:sdgdsffdsfff,項目名稱:hdf-client,代碼行數:13,代碼來源:wrapper.php

示例2: getFileList

 private static function getFileList($dataPath)
 {/*{{{*/
     $dirList = XString::listDir($dataPath);
     $fileList = array();
     foreach ($dirList as $dirName)
     {
         $dirPath = $dataPath.$dirName;
         if (is_dir($dirPath))
         {
             $files = XString::listFile($dirPath, false);
             if ($files)
             {
                 $fileList[$dirName] = $files; 
             }
         }
     }
     return $fileList;
 }/*}}}*/
開發者ID:sdgdsffdsfff,項目名稱:hdf-client,代碼行數:18,代碼來源:indexcontroller.php

示例3: 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

示例4: completeData

 private function completeData($functionName)
 {/*{{{*/
     $className = str_replace("test", '', $functionName);
     $this->assertTrue(class_exists($className), $className."類不存在\n");
     $factory = new OpenFactory;
     $factory->wrapData();
     $dataPath = $configs->standardPath.strtolower($className);
     $configs =  BeanFinder::get('configs');
     $resPath = $configs->resPath.strtolower($className);
     $this->assertTrue(is_dir($resPath), $resPath."路徑不存在\n");
     $fileList = XString::listFile($resPath);
     $this->assertNotEmpty($fileList, $className."下沒有文件\n");
     XString::clearDir($dataPath);
     foreach ($fileList as $key => $file)
     {
         if (strstr($file, 'xml') == false)
         {
             unset ($fileList[$key]);
         }
     }
     return $fileList;
 }/*}}}*/
開發者ID:sdgdsffdsfff,項目名稱:hdf-client,代碼行數:22,代碼來源:datasource.php


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