Implementation process of PHP calculating information function of specified folder

黄舟
Release: 2023-03-15 09:22:01
Original
1092 people have browsed it

So in our daily development work, I believe that many friends have encountered how to calculate the information of a specified folder. Everyone should be familiar with this. Calculate the size of a folder, including subfolders. Formatted output folder size, number of files, number of subfolders information. Today I will introduce to you the implementation process of PHP's information function for calculating the specified folder!

Similarly, we still need to download the PHP function library used in this course to calculate the information of the specified folder:

http:/ /m.sbmmt.com/xiazai/leiku/792

After the download is completed, unzip the php file library we need to the local directory, and then create a new php file~

Then we need to call this class and instantiate this class in this new php file:

<?php
include_once "codehanshu.php"; //引入类文件
$path="../cache";               //定义指定文件夹路径

$ar=getDirectorySize($path);  //实例化

//输出结果
echo "<h4>路径 : $path</h4>";
echo "目录大小 : ".sizeFormat($ar[&#39;size&#39;])."<br>";
echo "文件数 : ".$ar[&#39;count&#39;]."<br>";
echo "目录术 : ".$ar[&#39;dircount&#39;]."<br>";
?>
Copy after login

Run the above code, and the result will be as shown below:

Implementation process of PHP calculating information function of specified folder

The above is the detailed content of Implementation process of PHP calculating information function of specified folder. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!