On Tuesday 17 July 2001 11:14 am, Boget, Chris wrote:
> in "my_api.inc", have the following code:
>
> echo "Currently Running file is: ";
> echo ( $CurrentRunningFile ) ? $CurrentRunningFile : __FILE__;
>
> in test.php
>
>$CurrentRunningFile = __FILE__;
>
> include( "my_api.inc" );
> echo
> I had that before.
> OK, seems that my problem is not that simple. The thing is ,
> I have something
> like this in my file test.php:
> require('my_api.inc');
> echo "This is test.php3";
> Now, in my_api.inc, I want to know that I run test.php3, when I do
> bash$ php test.php3
> and the filen
I had that before.
OK, seems that my problem is not that simple. The thing is , I have something
like this in my file test.php:
require('my_api.inc');
echo "This is test.php3";
Now, in my_api.inc, I want to know that I run test.php3, when I do
bash$ php test.php3
and the filename is test.php3
> Seems that $PHP_SELF is not defined when it's run from the
> command line.
Try:
__FILE__
Chris
gt; There may be a better way to do it, but this works for me, and it's only 4
> lines. :)
>
> JB
>
>
> - Original Message -
> From: "Reuben D Budiardja" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, July 17, 2001 7:48 AM
PROTECTED]>
Sent: Tuesday, July 17, 2001 7:48 AM
Subject: [PHP] Get filename in php command line
Hello,
How do I get the filename or script name if I run it in php comamnd line?
For
example, if I run this
bash$ php test.php
I want to get something inside test.php that tells me the filename
Hello,
How do I get the filename or script name if I run it in php comamnd line? For
example, if I run this
bash$ php test.php
I want to get something inside test.php that tells me the filename is
test.php, but *without* the actual path.
Thanks
Reuben D. Budiardja
--
PHP General Mailing Lis
7 matches
Mail list logo