[Sussex] PHP Question: How to include all files in a directory

Mark Harrison (Groups) mph at ascentium.co.uk
Sun Feb 13 22:14:26 UTC 2005


Steve Dobson wrote:

>Matt
>
>On Sun, Feb 13, 2005 at 07:36:22PM +0000, Matthew Macdonald-Wallace wrote:
>  
>
>>On Sun, 13 Feb 2005 13:05:14 +0000 Steve Dobson <steve at dobson.org> wrote:
>>    
>>
>>>I am developing a little PHP system and I want to make it easy
>>>for users/SysAdmins to add their own functions PHP extension routes.
>>>
>>>Is there any way of "require_once('lib/functions/*.php');" so that
>>>all the user has to do is install his functions in the lib/functions
>>>dir and the system will automatically pick them up.
>>>      
>>>
>>Steve,
>>
>>You could create a file called include.php and have it do the following:
>>
>>foreach($fileList)
>>{
>>	require_once("filename")
>>}
>>
>>and then just:
>>
>>require_once("include.php");
>>
>>bear in mind this is pseudo-code and could be extremely server intensive,
>>but it is one way I can think of!
>>    
>>
>
>But where do I get $fileList from?
>
>Steve
>  
>
system ("ls /.../lib/functions/*.php > ./listfilename")
$fp = fopen("./listfilename")

?

M.




More information about the Sussex mailing list