本文整理汇总了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;
}/*}}}*/