search
Homephp教程php手册PHP读取文件夹内有多少个文件

PHP读取文件夹内有多少个文件

Jun 13, 2016 am 10:34 AM
pphpindivualfunctionHow manydocumentfolderofread

PHP读取一个文件夹内有多少个文件的函数.
比如有一个Pic文件夹,里面有100张图片,下面的函数可以得到他的总数100

$dir = ./pic;
$handle = opendir($dir);
$i = 0;
while(false !== $file=(readdir($handle))){
if($file !== . || $file != ..){
$i ;
}
}
closedir($handle);
echo $i;
?>

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.