PHP Check if any file is under certain directory |
For a list of all requirements and guidelines pertaining to posting a new Help topic, please click here.
This Month's Contests | Staff Member of the Month | Hosts Looking for Hostees | Hostees looking for Hosts | BigBookofResources
Submission Guidelines
PHP Check if any file is under certain directory |
Sep 27 2010, 10:07 PM
Post
#1
|
|
Mel Blanc was allergic to carrots. Group: Official Designer Posts: 6,371 Joined: Aug 2008 Member No: 676,291 |
Thinking it'd a be a lot more efficient, I was wondering: how do you check to see if a file is under a certain directory? Basically, it would be something similar to a wildcard or something.
I'm pretty familiar with checking the URL's file name (in the most basic method): CODE <?php $uri = $_SERVER['SCRIPT_NAME']; if ($uri == '/path/to/file.php') echo 'Woo.'; else echo 'Aw.'; ?> Now, what I'm imagining, when it comes to checking for any file under a directory, is this: CODE <?php $uri = $_SERVER['SCRIPT_NAME']; $name = *WILDCARD SORT OF SHIT HERE*; if ($uri == '/path/to/' . $name . '.php') echo 'Woo.'; else echo 'Aw.'; ?> Any ideas would be awesomely appreciated. Yeah, awesomely is a word. |
|
|