本文整理匯總了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;
}/*}}}*/
示例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;
}/*}}}*/
示例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);
}
}
}
}
}/*}}}*/
示例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;
}/*}}}*/