Jump to content

Can not get glob to work


maexus

Recommended Posts

Here is my directory structure

 

/projectname/

index.php

/lib/

-master.inc.php

-/includes/

--page.class.php

--cache.inc.php

 

What I want to do is include master.inc.php into index.php. master.inc.php will include all php files in the sub dir "includes". Here is the code I'm using.

 

<?php foreach(glob(realpath('includes')."/*.php") as $include){require_once $include;} ?>

 

Now, I try to envoke a new instance of the page class and says it's not found when used on index.php however when I invoke the page class directly in master.inc.php.. it works. I can change require_once $include to echo $include and it will echo out the file names and the directories they are in so I don't understand why it doesn't work in index.php Please help.

Link to comment
https://forums.phpfreaks.com/topic/73048-can-not-get-glob-to-work/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.