Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 动态获取上次修改的文件时间_Php_Filemtime - Fatal编程技术网

Php 动态获取上次修改的文件时间

Php 动态获取上次修改的文件时间,php,filemtime,Php,Filemtime,我做过几次不成功的尝试。我想按当前文件(即当前正在查看的文件)获取上次修改的文件时间。下面的代码适用于employer.es.php文件,但我会在其他文件中重用它,除非我不断更改文件名 <?php // make var from file name $last_modified = filemtime("employer.es.php"); // print date echo "Information last modified on " . d

我做过几次不成功的尝试。我想按当前文件(即当前正在查看的文件)获取上次修改的文件时间。下面的代码适用于employer.es.php文件,但我会在其他文件中重用它,除非我不断更改文件名

    <?php
    // make var from file name
    $last_modified = filemtime("employer.es.php");
    // print date
    echo "Information last modified on " . date("m/d/Y", $last_modified);
    ?> 

因此,我希望它使用当前文件,而不是在每个文件中键入文件名。 希望我说的有道理:/ 谢谢大家!

这里的
\uuuuuuuuuuuuuuuuuuuuuuuu
应该可以帮助您


$last\u modified=filemtime(\u文件\u)

此外,如果在脚本执行期间(可能在
filemtime()
之前)对脚本执行多个文件系统操作,我强烈建议实现.Ugh。我试过了,但是没有正确的语法。现在工作!非常感谢你的推荐,我会看看的。