本文整理汇总了PHP中folder_info函数的典型用法代码示例。如果您正苦于以下问题:PHP folder_info函数的具体用法?PHP folder_info怎么用?PHP folder_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了folder_info函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: count
$n_files = count($files);
//php sorting
$sorted = array();
$current_folder = array();
$prev_folder = array();
$current_files_number = 0;
$current_folders_number = 0;
foreach ($files as $k => $file) {
if ($file == ".") {
$current_folder = array('file' => $file);
} elseif ($file == "..") {
$prev_folder = array('file' => $file);
} elseif (is_dir($current_path . $rfm_subfolder . $subdir . $file)) {
$date = filemtime($current_path . $rfm_subfolder . $subdir . $file);
if ($show_folder_size) {
list($size, $nfiles, $nfolders) = folder_info($current_path . $rfm_subfolder . $subdir . $file);
$current_folders_number++;
} else {
$size = 0;
}
$file_ext = trans('Type_dir');
$sorted[$k] = array('file' => $file, 'file_lcase' => strtolower($file), 'date' => $date, 'size' => $size, 'nfiles' => $nfiles, 'nfolders' => $nfolders, 'extension' => $file_ext, 'extension_lcase' => strtolower($file_ext));
} else {
$current_files_number++;
$file_path = $current_path . $rfm_subfolder . $subdir . $file;
$date = filemtime($file_path);
$size = filesize($file_path);
$file_ext = substr(strrchr($file, '.'), 1);
$sorted[$k] = array('file' => $file, 'file_lcase' => strtolower($file), 'date' => $date, 'size' => $size, 'extension' => $file_ext, 'extension_lcase' => strtolower($file_ext));
}
}
开发者ID:met-mw,项目名称:SCMS,代码行数:31,代码来源:dialog.php
示例2: response
if ($action != 'copy' && $action != 'cut') {
response(trans('wrong action') . AddErrorLocation())->send();
exit;
}
// check for writability
if (is_really_writable($path) === FALSE || is_really_writable($path_thumb) === FALSE) {
response(trans('Dir_No_Write') . '<br/>' . str_replace('../', '', $path) . '<br/>' . str_replace('../', '', $path_thumb) . AddErrorLocation())->send();
exit;
}
// check if server disables copy or rename
if (is_function_callable($action == 'copy' ? 'copy' : 'rename') === FALSE) {
response(sprintf(trans('Function_Disabled'), $action == 'copy' ? trans('Copy') : trans('Cut')) . AddErrorLocation())->send();
exit;
}
if ($action == 'copy') {
list($sizeFolderToCopy, $fileNum, $foldersCount) = folder_info($path, false);
if (!checkresultingsize($sizeFolderToCopy)) {
response(sprintf(trans('max_size_reached'), $MaxSizeTotal) . AddErrorLocation())->send();
exit;
}
rcopy($data['path'], $path);
rcopy($data['path_thumb'], $path_thumb);
} elseif ($action == 'cut') {
rrename($data['path'], $path);
rrename($data['path_thumb'], $path_thumb);
// cleanup
if (is_dir($data['path']) === TRUE) {
rrename_after_cleaner($data['path']);
rrename_after_cleaner($data['path_thumb']);
}
}
开发者ID:Dipchikov,项目名称:bludit-plugins,代码行数:31,代码来源:execute.php
示例3: checkresultingsize
/**
* check if the current folder size plus the added size is over the overall size limite
*
* @param int $sizeAdded
*
* @return bool
*/
function checkresultingsize($sizeAdded)
{
global $MaxSizeTotal, $current_path;
if ($MaxSizeTotal !== false && is_int($MaxSizeTotal)) {
list($sizeCurrentFolder, $fileCurrentNum, $foldersCurrentCount) = folder_info($current_path, false);
// overall size over limit
if ($MaxSizeTotal * 1024 * 1024 < $sizeCurrentFolder + $sizeAdded) {
return false;
}
}
return true;
}
开发者ID:crabstudio,项目名称:app,代码行数:19,代码来源:utils.php
示例4: path_list
/**
* 获取文件夹下列表信息
* dir 包含结尾/ d:/wwwroot/test/
* 传入需要读取的文件夹路径,为程序编码
*/
function path_list($dir, $list_file = true, $check_children = false)
{
$dir = rtrim($dir, '/') . '/';
if (!is_dir($dir) || !($dh = opendir($dir))) {
return array('folderlist' => array(), 'filelist' => array());
}
$folderlist = array();
$filelist = array();
//文件夹与文件
while (($file = readdir($dh)) !== false) {
if ($file != "." && $file != ".." && $file != ".svn") {
$fullpath = $dir . $file;
if (is_dir($fullpath)) {
$info = folder_info($fullpath);
if ($check_children) {
$info['isParent'] = path_haschildren($fullpath, $list_file);
}
$folderlist[] = $info;
} else {
if ($list_file) {
//是否列出文件
$info = file_info($fullpath);
if ($check_children) {
$info['isParent'] = false;
}
$filelist[] = $info;
}
}
}
}
closedir($dh);
return array('folderlist' => $folderlist, 'filelist' => $filelist);
}
开发者ID:WPG,项目名称:KODExplorer,代码行数:38,代码来源:file.function.php
示例5: folder_info
/**
* Determine directory size
*
* @param string $path
*
* @return int
*/
function folder_info($path)
{
$total_size = 0;
$files = scandir($path);
$cleanPath = rtrim($path, '/') . '/';
$files_count = 0;
$folders_count = 0;
foreach ($files as $t) {
if ($t != "." && $t != "..") {
$currentFile = $cleanPath . $t;
if (is_dir($currentFile)) {
list($size, $tmp, $tmp1) = folder_info($currentFile);
$total_size += $size;
$folders_count++;
} else {
$size = filesize($currentFile);
$total_size += $size;
$files_count++;
}
}
}
return array($total_size, $files_count, $folders_count);
}
开发者ID:johnsondelbert1,项目名称:prj-illuminate,代码行数:30,代码来源:utils.php
注:本文中的folder_info函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论