通过PHP获取文件创建与修改时间

1.获取文件创建时间示例:

1
2
$ctime=filectime("chinawinxp.txt");
echo "创建时间:".date("Y-m-d H:i:s",$ctime);

2.获取文件修改时间示例:

1
2
$mtime=filemtime("chinawinxp.txt");
echo "修改时间:".date("Y-m-d H:i:s",$mtime);

 

 

$stat = stat('./a.php');

echo '上次访问<a href="https://www.baidu.com/s?wd=%E6%97%B6%E9%97%B4%E6%88%B3&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dBuy7hrHmknyckPHc3nW9-0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPW6YnHRsnjb1P1TvnWbsnjRz" target="_blank" class="baidu-highlight">时间戳</a>: ' $stat['atime'].'<br />';
echo '上次修改戳: ' $stat['mtime'].'<br />';
echo '上次改变<a href="https://www.baidu.com/s?wd=%E6%97%B6%E9%97%B4%E6%88%B3&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1dBuy7hrHmknyckPHc3nW9-0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EPW6YnHRsnjb1P1TvnWbsnjRz" target="_blank" class="baidu-highlight">时间戳</a>: ' $stat['ctime'].'<br />';
posted @ 2018-01-21 15:12  追忆丶年华  阅读(1422)  评论(0编辑  收藏  举报