Welcome to dbForumz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

getting the name of the PHP file

 
   Database Forums (Home) -> PHP RSS
Next:  fopen bloody problem  
Author Message
Tuomas

External


Since: Sep 10, 2006
Posts: 2



(Msg. 1) Posted: Sun Sep 10, 2006 12:09 pm
Post subject: getting the name of the PHP file
Archived from groups: comp>lang>php (more info?)

Hi! I am a PHP beginner, and I don't know my way around. Let's say I
have a file named as "file.php". Is there a special variable that
already includes the file name, or should I just manually code it into
the script; i.e. $filename = "file.php"? I am writing a script that
prints out some information about each HTML/PHP file in my home
directory. The name of the file is among them.

Thanks for your time!
Tuomas

 >> Stay informed about: getting the name of the PHP file 
Back to top
Login to vote
Mateusz Markowski

External


Since: Sep 11, 2006
Posts: 1



(Msg. 2) Posted: Sun Sep 10, 2006 12:09 pm
Post subject: Re: getting the name of the PHP file [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Tuomas napisal(a):
> Hi! I am a PHP beginner, and I don't know my way around. Let's say I
> have a file named as "file.php". Is there a special variable that
> already includes the file name, or should I just manually code it into
> the script; i.e. $filename = "file.php"? I am writing a script that
> prints out some information about each HTML/PHP file in my home
> directory. The name of the file is among them.

basename(__FILE__)

 >> Stay informed about: getting the name of the PHP file 
Back to top
Login to vote
Phil

External


Since: Sep 10, 2006
Posts: 1



(Msg. 3) Posted: Sun Sep 10, 2006 10:09 pm
Post subject: Re: getting the name of the PHP file [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Tuomas wrote, On 10/09/06 9.09 p:
> Hi! I am a PHP beginner, and I don't know my way around. Let's say I
> have a file named as "file.php". Is there a special variable that
> already includes the file name, or should I just manually code it into
> the script; i.e. $filename = "file.php"? I am writing a script that
> prints out some information about each HTML/PHP file in my home
> directory. The name of the file is among them.

You want the magic constant __FILE__, take a read of
<http://nz.php.net/manual/en/language.constants.predefined.php> for more
information on them.

-Phil
 >> Stay informed about: getting the name of the PHP file 
Back to top
Login to vote
Tuomas

External


Since: Sep 10, 2006
Posts: 2



(Msg. 4) Posted: Sun Sep 10, 2006 10:09 pm
Post subject: Re: getting the name of the PHP file [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Phil wrote:
> You want the magic constant __FILE__, take a read of
> <http://nz.php.net/manual/en/language.constants.predefined.php> for more
> information on them.
>
> -Phil

Thanks, guys!
 >> Stay informed about: getting the name of the PHP file 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
how do you open a file with quote marks in the file name o.. -

want to get content of one php file in another php file - i have one php file having content Contents of ex1.php file <body> <?php $content = "c://webserver/www/abc.php"; $handle = fopen($content, "r"); echo fread($handle,filesize($content)); ?> </body> this is reading abc...

File selection? - I'm running some php scripts locally (Windoze XP) to operate on local files and, at least partly because I can't seem to access the parameters via argv[] or get it to print out in my DOS box, it seems sensible to run it via a web page (I'm running..

deleting row in csv file - hello, i have made a script to read/add and update rows in an csv file. it works fine. but when i change an existing row i want the original row to disapear. now i get two rows: the original one en the changed one. so my question is: how can i delete ...

Generated file - Hello, I am 99% sure that the problem I am having is not PHP related, but to remove my doubt, I am posting here. I have a search page (interfacing with MySql) that displays results in an IFRAME on the search page. I did this so the whole page would..
   Database Forums (Home) -> PHP All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]