Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > alt.comp.lang.php > #62
| From | Arno Welzel <usenet@arnowelzel.de> |
|---|---|
| Newsgroups | comp.lang.php, alt.comp.lang.php, alt.php |
| Subject | Re: Newbie needs recommendation for fast learning a little php. |
| Date | 2021-07-01 10:49 +0200 |
| Message-ID | <ik5dseFatucU1@mid.individual.net> (permalink) |
| References | <rdbmdghp8532b2sgknb9iqv6a0i6vlom8p@4ax.com> <35nodg56nqinnfigtl6251fhlpkb42vb61@4ax.com> <ik38p4Fsqc5U1@mid.individual.net> <ut9pdg5ou2tg89810v9eshhv1p26c1snl2@4ax.com> |
Cross-posted to 3 groups.
Not_even_a_newbie@example.net:
> On Wed, 30 Jun 2021 15:09:57 +0200, Arno Welzel <usenet@arnowelzel.de>
> wrote:
[...]
>> Much simpler:
>>
>> <?php
>> echo "This file was last modified on: ";
>> echo date("Y-m-d H:m",filemtime($_SERVER["SCRIPT_FILENAME"]));
>> ?>
>
> Thanks for that. I've plugged this in and saved it as foo.php and I
> get an odd reaction. The actual time stamp on the file is 13:22, but
> the above script is telling me that the file was last modified at
> 13:06. I suppose that the idiots at my Web host may have screwed up
> something on the server. The 13:22 time is when I created the file, so
> it can't be that it's showing when it was created and not when it was
> modified. I'm scratching my head here.
You can also try this to make sure the file system cache is emptied:
<?php
clearstatcache($_SERVER["SCRIPT_FILENAME"]);
echo "This file was last modified on: ";
echo date("Y-m-d H:m",filemtime($_SERVER["SCRIPT_FILENAME"]));
?>
And if this doesn't work, use a global cache clear:
<?php
clearstatcache();
echo "This file was last modified on: ";
echo date("Y-m-d H:m",filemtime($_SERVER["SCRIPT_FILENAME"]));
?>
Also see: <https://www.php.net/manual/en/function.clearstatcache.php>
>> Also see:
>>
>> <https://www.php.net/manual/en/reserved.variables.server.php>
>>
>> "'SCRIPT_FILENAME'
>>
>> The absolute pathname of the currently executing script."
>
> Okay, I don't understand what you mean in the piece immediately above
> this. The above url seems to say that the script will just run.
$_SERVER is a super global array which provides a number of runtime
parameters of the current script. $_SERVER["SCRIPT_FILENAME"] contains
the complete name of the current script including the path or the name
which was passed at command line when using PHP as CLI.
--
Arno Welzel
https://arnowelzel.de
Back to alt.comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar
Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-06-29 10:30 -0400
Re: Newbie needs recommendation for fast learning a little php. "J.O. Aho" <user@example.net> - 2021-06-29 21:01 +0200
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-06-30 05:58 -0400
Tell him to go to He Llo <ya12983@mail.com> - 2021-08-16 05:26 -0700
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-06-30 08:08 -0400
Re: Newbie needs recommendation for fast learning a little php. Arno Welzel <usenet@arnowelzel.de> - 2021-06-30 15:09 +0200
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-06-30 13:46 -0400
Re: Newbie needs recommendation for fast learning a little php. Arno Welzel <usenet@arnowelzel.de> - 2021-07-01 10:49 +0200
Re: Newbie needs recommendation for fast learning a little php. "J.O. Aho" <user@example.net> - 2021-06-30 16:24 +0200
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-06-30 13:49 -0400
Re: Newbie needs recommendation for fast learning a little php. "J.O. Aho" <user@example.net> - 2021-06-30 22:23 +0200
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-07-01 00:49 -0400
Re: Newbie needs recommendation for fast learning a little php. "J.O. Aho" <user@example.net> - 2021-07-01 08:03 +0200
Re: Newbie needs recommendation for fast learning a little php. Arno Welzel <usenet@arnowelzel.de> - 2021-07-01 12:35 +0200
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-07-02 18:21 -0400
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-07-02 19:36 -0400
Re: Newbie needs recommendation for fast learning a little php. John-Paul Stewart <jpstewart@personalprojects.net> - 2021-07-02 20:01 -0400
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-07-03 00:08 -0400
Re: Newbie needs recommendation for fast learning a little php. Arno Welzel <usenet@arnowelzel.de> - 2021-07-03 15:40 +0200
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-07-03 14:36 -0400
Re: Newbie needs recommendation for fast learning a little php. rcpj@panix.com (Pierre Jelenc) - 2021-07-01 21:36 +0000
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-07-02 18:49 -0400
Re: Newbie needs recommendation for fast learning a little php. rcpj@panix.com (Pierre Jelenc) - 2021-07-02 23:02 +0000
Re: Newbie needs recommendation for fast learning a little php. Arno Welzel <usenet@arnowelzel.de> - 2021-07-01 12:29 +0200
Re: Newbie needs recommendation for fast learning a little php. Ray_Net <Ray_Net@picarre.be.invalid> - 2021-06-30 23:03 +0200
Re: Newbie needs recommendation for fast learning a little php. Not_even_a_newbie@example.net - 2021-07-02 18:07 -0400
Re:Newbie needs recommendation for fast learning a little php. Blue Hat <blue_hat@hackershaven.com.jm> - 2021-08-08 13:43 -0500
Re: Newbie needs recommendation for fast learning a little php. "He, who travels time to time" <he1983912@aol.com> - 2022-09-22 07:14 -0700
csiph-web