函数名称:rar_wrapper_cache_stats()
函数说明:rar_wrapper_cache_stats() 函数用于获取 RAR 文件的缓存统计信息。
适用版本:该函数在 PHP 7.2.0 及以上版本中可用。
语法:rar_wrapper_cache_stats()
返回值:该函数返回一个数组,包含以下键值对:
示例:
<?php
// 打开 RAR 文件
$rar = rar_open('example.rar');
// 获取缓存统计信息
$cacheStats = rar_wrapper_cache_stats();
// 输出统计结果
echo "缓存中的文件数量:{$cacheStats['cached_files']}\n";
echo "缓存中的目录数量:{$cacheStats['cached_dirs']}\n";
echo "缓存中所有文件和目录的总大小:{$cacheStats['total_size']} 字节\n";
// 关闭 RAR 文件
rar_close($rar);
?>
注意事项:
rar_wrapper_cache_stats() 函数之前,需要先通过 rar_open() 函数打开一个 RAR 文件。false。