php filectime filemtime,php文件时间函数fileatime filemtime filectime区别实例讲解

fileatime

fileatime返回文件上次被访问的时间, 或者在失败时返回 FALSE 。时间以 Unix 时间戳的方式返回。

实例:

$file = "test.txt";

outputFileTestInfo( $file );

function outputFileTestInfo( $f ){

if ( ! file_exists( $f ) ){

print "$f does not exist
";

return;

}

print "$f was accessed on ".date( "D d M Y g:i A", fileatime( $f ) )."
";

}

?>

filemtime

filemtime函数返回文件中的数据块上次被写入的时间,也就是说,文件的内容上次被修改的时间。

实例:

$file = "test.txt";

outputFileTestInfo( $file );

/* http://www.manongjc.com/article/1374.html */

function outputFileTestInfo( $f ){

if ( ! file_exists( $f ) ){

print "$f does not exist
";

return;

}

print "$f was modified on ".date( "D d M Y g:i A", filemtime( $f ) )."
";

}

?>

filectime

filectime返回文件上次 inode 被修改的时间,即文件创建时间, 或者在失败时返回 FALSE 。 时间以 Unix 时间戳的方式返回。

$file = "test.txt";

outputFileTestInfo( $file );

function outputFileTestInfo( $f ){

if ( ! file_exists( $f ) ){

print "$f does not exist
";

return;

}

print "$f was changed on ".date( "D d M Y g:i A", filectime( $f ) )."
";

}

?>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值