filemtime ( string filename )
返回文件上次被修改的時(shí)間,出錯(cuò)時(shí)返回 FALSE。時(shí)間以 Unix 時(shí)間戳的方式返回,可用于 date()。
filectime ( string filename )
返回文件上次 inode 被修改的時(shí)間,如果出錯(cuò)則返回 FALSE。時(shí)間以 Unix 時(shí)間戳的方式返回。
fileatime ( string filename )
返回文件上次被訪問的時(shí)間,如果出錯(cuò)則返回 FALSE。時(shí)間以 Unix 時(shí)間戳的方式返回。
////////////////////////////
filectime:linux最后一次修改時(shí)間
filemtime:最后一次修改時(shí)間
fileatime:最后一次訪問的時(shí)間
/////////////////////////////////////////////////////////////////////////////
filemtime
(PHP 3, PHP 4 )
filemtime -- 取得文件修改時(shí)間
說明
int filemtime ( string filename)
返回文件上次被修改的時(shí)間,出錯(cuò)時(shí)返回 FALSE。時(shí)間以 Unix 時(shí)間戳的方式返回,可用于 date()。
注: 本函數(shù)的結(jié)果會(huì)被緩存。詳細(xì)信息參見 clearstatcache()。
注: 本函數(shù)不能作用于遠(yuǎn)程文件,被檢查的文件必須通過服務(wù)器的文件系統(tǒng)訪問。
本函數(shù)返回文件中的數(shù)據(jù)塊上次被寫入的時(shí)間,也就是說,文件的內(nèi)容上次被修改的時(shí)間。
例子 1. filemtime() 例子
<?php// outputs e.g. somefile.txt was last modified: December 29 2002 22:16:23.$filename = 'somefile.txt';if (file_exists($filename)) { echo "$filename was last modified: " . date ("F d Y H:i:s.", filemtime($filename));}?> filectime
(PHP 3, PHP 4 )
filectime -- 取得文件的 inode 修改時(shí)間
說明
int filectime ( string filename)
返回文件上次 inode 被修改的時(shí)間,如果出錯(cuò)則返回 FALSE。時(shí)間以 Unix 時(shí)間戳的方式返回。
注意:在大多數(shù) Unix 文件系統(tǒng)中,當(dāng)一個(gè)文件的 inode 數(shù)據(jù)被改變時(shí)則該文件被認(rèn)為是修改了。也就是說,當(dāng)文件的權(quán)限,所有者,所有組或其它 inode 中的元數(shù)據(jù)被更新時(shí)。參見 filemtime()(這才是你想用于在 web 頁面中建立“最后更新時(shí)間”腳注的函數(shù))和 fileatime()。
注意某些 Unix 說明文本中把 ctime 說成是該文件建立的時(shí)間,這是錯(cuò)的。在大多數(shù) Unix 文件系統(tǒng)中沒有 Unix 文件的建立時(shí)間。
注: 本函數(shù)的結(jié)果會(huì)被緩存。詳細(xì)信息參見 clearstatcache()。
注: 本函數(shù)不能作用于遠(yuǎn)程文件,被檢查的文件必須通過服務(wù)器的文件系統(tǒng)訪問。
例子 1. fileatime() 例子
<?php// 輸出類似:somefile.txt was last changed: December 29 2002 22:16:23.$filename = 'somefile.txt';if (file_exists($filename)) { echo "$filename was last changed: " . date ("F d Y H:i:s.", filectime($filename));}?> fileatime
(PHP 3, PHP 4 )
fileatime -- 取得文件的上次訪問時(shí)間
說明
int fileatime ( string filename)
返回文件上次被訪問的時(shí)間,如果出錯(cuò)則返回 FALSE。時(shí)間以 Unix 時(shí)間戳的方式返回。
注意:一個(gè)文件的 atime 應(yīng)該在不論何時(shí)讀取了此文件中的數(shù)據(jù)塊時(shí)被更改。當(dāng)一個(gè)應(yīng)用程序定期訪問大量文件或目錄時(shí)很影響性能。有些 Unix 文件系統(tǒng)可以在加載時(shí)關(guān)閉 atime 的更新以提高這類程序的性能。USENET 新聞組假脫機(jī)是一個(gè)常見的例子。在這種文件系統(tǒng)下本函數(shù)沒有用處。
注: 本函數(shù)的結(jié)果會(huì)被緩存。詳細(xì)信息參見 clearstatcache()。
注: 本函數(shù)不能作用于遠(yuǎn)程文件,被檢查的文件必須通過服務(wù)器的文件系統(tǒng)訪問。
例子 1. fileatime() 例子
<?php// 輸出類似:somefile.txt was last accessed: December 29 2002 22:16:23.$filename = 'somefile.txt';if (file_exists($filename)) { echo "$filename was last accessed: " . date ("F d Y H:i:s.", fileatime($filename));}?>新聞熱點(diǎn)
疑難解答
圖片精選