15
นับจำนวนไฟล์ในไดเรกทอรี PHP
ฉันกำลังทำโปรเจ็กต์ใหม่เล็กน้อย ฉันอยากรู้ว่ามีกี่ไฟล์ในไดเร็กทอรีหนึ่ง <div id="header"> <?php $dir = opendir('uploads/'); # This is the directory it will count from $i = 0; # Integer starts at 0 before counting # While false is not equal to the filedirectory while (false !== ($file = readdir($dir))) { if (!in_array($file, array('.', '..') and !is_dir($file)) $i++; …