I want to create a list the names of the files which have been last modified at
http://www.searchr.us/web-search/
I want to show these file names on my Homepage and they s开发者_JAVA百科hould change according to the last modified files !!
You can use this function
function listdir_by_date($path){
$dir = opendir($path);
$list = array();
while($file = readdir($dir)){
if ($file != '.' and $file != '..'){
// add the filename, to be sure not to
// overwrite a array key
$mtime = filemtime($data_path . $file) . ',' . $file;
$list[$mtime] = $file;
}
}
closedir($dir);
krsort($list);
return $list;}
You can then loop through $list and echo accordingly.
Basically You can use the filemtime() function described here.
This is not possible.
See the manual for filemtime
:
As of PHP 5.0.0, this function can also be used with some URL wrappers. Refer to List of Supported Protocols/Wrappers for a listing of which wrappers support stat() family of functionality.
and the manual page for HTTP/HTTPS stream wrappers:
Supports stat() No
Chech out this GitHub repository: ZFYL/zipper
Download index.php and zipper.php and insert them in any accessable directory on your server. Then opening it in the browser, setup the main page (from date, until date, path to look recursively)
And after that you can eithe list those files modified in the given time period.
Or you can use the function library zipper.php, include it, and read the How to use functions from ZFYL zipper in your code in the repo wiki on GitHub.
精彩评论