0

Is there any method in Cakephp that is able to return the latest modified file in a directory? I have tried with $this->System->getLatestModifiedFile() in Cakephp Model but got Call to a member function getLatestModifiedFile() on a non-object error.

Thanks for advice there!

4

2 回答 2

0

参考 cakephp 文件和文件夹 API,我设法使用File::lastChange()方法来解决我的问题。感谢那里的帮助。这是一个例子:

App::uses('Folder', 'Utility');
App::uses('File', 'Utility');
$file = new File('/tmp/test.txt');
//the following will return an epoch time, can be formatted by date method
echo $file->lastChange();
于 2013-10-08T13:45:47.167 回答
0

请浏览http://book.cakephp.org/2.0/en/core-utility-libraries/file-folder.htmlFile::lastChange()在 File API 部分查找。这可能会有所帮助。

于 2013-10-01T06:08:56.313 回答