문제

I've made a few unsuccessful attempts. I want to get the last modified file time, by current file - i.e. the file currently being viewed. The following code works for the employer.es.php file, but I reuse this in other files unless I keep changing the file names.

    <?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);
    ?> 

So instead of having to type the files name into each file, I want it to use the current file. Hope I'm making sense :/ Thank you!

도움이 되었습니까?

해결책

The __FILE__ magic constant should help you out here.

$last_modified = filemtime(__FILE__);

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top