karbar98 19 ارسال شده در تیر 91 گزارش بازنشر ارسال شده در تیر 91 سلامتابعی که در زیر قرار دادم تمامی محتویات یک فولدر رو نشون می ده ، حالا مشکل همین جاست که من می خواهم تعدادی فایل و پوشه رو به دلخواه نشون ندهد ، یعنی تمامی محویات یک فولدر به جز اون هایی که بهش می گیم رو نشون بدهد.<?php// open the current directory$dhandle = opendir('.');// define an array to hold the files$files = array();if ($dhandle) { // loop through all of the files while (false !== ($fname = readdir($dhandle))) { // if the file is not this file, and does not start with a '.' or '..', // then store it for later display if (($fname != '.') && ($fname != '..') && ($fname != basename($_SERVER['PHP_SELF']))) { // store the filename $files[] = (is_dir( "./$fname" )) ? "{$fname}" : $fname; } } // close the directory closedir($dhandle);}echo "\n";// Now loop through the files, echoing out a new select option for each oneforeach( $files as $fname ){ echo "<img src='http://cdn3.iconfinder.com/data/icons/fatcow/32x32_0440/folder.png' style='margin-bottom:-10px;'/> <a href='{$fname}'>{$fname}</a>\n <br />";}echo "\n";?> نقل قول لینک به ارسال
Parsa 23463 ارسال شده در تیر 91 گزارش بازنشر ارسال شده در تیر 91 نام فایلها را در متغییر آرایهای exclude قرار دهید<?php// open the current directory$dhandle = opendir('.');// define an array to hold the files$files = array();$exclude = array('a','d');if ($dhandle) { // loop through all of the files while (false !== ($fname = readdir($dhandle))) { // if the file is not this file, and does not start with a '.' or '..', // then store it for later display if (($fname != '.') && ($fname != '..') && ($fname != basename($_SERVER['PHP_SELF'])) && (! in_array($fname, $exclude))) { // store the filename $files[] = (is_dir( "./$fname" )) ? "{$fname}" : $fname; } } // close the directory closedir($dhandle);}echo "\n";// Now loop through the files, echoing out a new select option for each oneforeach( $files as $fname ){ echo "<img src='http://cdn3.iconfinder.com/data/icons/fatcow/32x32_0440/folder.png' style='margin-bottom:-10px;'/> <a href='{$fname}'>{$fname}</a>\n <br />";}echo "\n";?> 2 نقل قول لینک به ارسال
karbar98 19 ارسال شده در تیر 91 مالک گزارش بازنشر ارسال شده در تیر 91 بسیار ممنون ، مشکلم به طور کامل حل شد. نقل قول لینک به ارسال
پست های پیشنهاد شده
به گفتگو بپیوندید
هم اکنون می توانید مطلب خود را ارسال نمایید و بعداً ثبت نام کنید. اگر حساب کاربری دارید، برای ارسال با حساب کاربری خود اکنون وارد شوید .