FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PHP script to get name of file which houses the script?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: PHP script to get name of file which houses the script? [message #185002 is a reply to message #184997] Sun, 23 February 2014 20:40 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On Sun, 23 Feb 2014 11:47:04 -0800, rnetzlof wrote:

> What I don't like is the need for $file_name='mtg10.php'; It would be
> much handier if I could write something like
> $file_name=getNameOfThisFile(); instead.

is this:

$file_name = __FILE__;

what you're looking for?

http://www.php.net/manual/en/language.constants.predefined.php

Make sure you read the manual page before using it, as it's quite likely
not going to give exactly the same value as "$file_name =
string_literal;" will.

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Help with regex
Next Topic: JavaScript to PHP
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 04:55:23 GMT 2024

Total time taken to generate the page: 0.05132 seconds