#1
  1. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2000
    Location
    Hong Kong
    Posts
    71
    Rep Power
    15
    Anyone know that how to find the current directory's name in php?

    I need the php automatic to find its current directory's name.

    Thanks!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Posts
    38
    Rep Power
    15
    the Apache variable to get the script name and directory is $SCRIPT_FILENAME

    that would let you get that and parse it out

  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    1
    Rep Power
    0
    $dir = ereg_replace("**this_php_filename.php3", '',$PATH_TRANSLATED);

    Is how I got it. (it's all one line)

    **this_php_filename.php3 - is the name of the current file - the file contining the above line. We're just replacing it with nothing in the constant $PATH_TRANSLATED

    Hope this helps.



    ------------------
    :-)
    John

Similar Threads

  1. Replies: 1
    Last Post: January 30th, 2004, 11:51 AM
  2. Odd problem with a hash and foreach loop
    By quantumechanix in forum Perl Programming
    Replies: 7
    Last Post: December 15th, 2003, 06:06 PM
  3. using file tests outside of current directory
    By Crobe in forum Perl Programming
    Replies: 4
    Last Post: October 22nd, 2003, 01:28 PM

IMN logo majestic logo threadwatch logo seochat tools logo