PhP Функция для подключения всех файлов в директории

Данная функция подключает все файлы находящиеся в указанной директории:

<?php
function include_from($dir, $ext='php'){
$opened_dir = opendir($dir);

while ($element=readdir($opened_dir)){
$fext=substr($element,strlen($ext)*-1);
if(($element!='.') && ($element!='..') && ($fext==$ext)){
include($dir.$element);
}
}
closedir($opened_dir);
}
?>

Leave a Reply

Ваш адрес email не будет опубликован. Обязательные поля помечены *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>