有什么方法可以获取PHP创建文件的时间吗?
手册上说filectime()
不能那样做?
有办法吗?
filectime()
会执行此操作,但如果使用窗口,则可以获得创建时间but if you are using UNIX you can get the change time and that would be all.
试试这个例子在windows上,CTime是创建时间,使用以下内容:
<?php
$files = array();
foreach (new DirectoryIterator('/path') as $fileInfo) {
$files[$fileInfo->getFileName()] = $fileInfo->getCTime();
}
arsort($files);
这将为您提供php
在PHP中,您可以通过以下方式获取"文件创建日期":
示例:
<?php
echo filemtime("test.txt");
echo "<br />";
echo "Last modified: ".date("F d Y H:i:s.",filemtime("test.txt"));
?>
你会得到这种类型的输出:
11388197
Last modified: February 01 2006 18:49:37.