Jump to content

How to control Glob(


acroporas

Recommended Posts

I'm trying to figure out how to control which folder the glob( function looks at?  (I've noticed that it does not allways search the same folder that the php file calling the function is in.) 

Is there a website that goes into more detail about the funtions than what is found in the php manual.


Also, is there a better way to get the list of files in a folder that is more easily controlable?

Thanks

Will

Link to comment
Share on other sites

It is difficult to post code snippets as  the problem is not in just one line but I can explain one example of what I call 'hard to control' 

I have the following file system.

home directory
          header.php

          child directory 1
                  page.php

         child directory 2
                 java.js

page.php has in it the line:    include ( ../header.php )
and
header.php has in it the line:  glob('*.*')

Case 1:  header.php has the line "../child-directory2/java.js"
Glob returns files in home directory.

Case 2:  header.php has the line "http://www.home directory.com/child directory 2/java.js"
Glob returns files in child directory 1

Edit...I've change my code significantly so this is from memory so it may not be exactly as it was.  But the theme is accurate.  Changing how I refrenced the .js file from a relative link to a absolute link changed wich directory glob would search.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.