略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: SplFileInfo::getCTime

2024-12-21

SplFileInfo::getCTime

(PHP 5 >= 5.1.2, PHP 7, PHP 8)

SplFileInfo::getCTime获取文件 inode 修改时间

说明

public SplFileInfo::getCTime(): int

返回此文件 inode 的修改时间,返回的时间是个 Unix 时间戳。

参数

此函数没有参数。

返回值

返回inode最后一次变更的时间戳。

错误/异常

错误时抛出 RunTimeException

范例

示例 #1 SplFileInfo::getCTime() 例子

<?php
$info 
= new SplFileInfo(__FILE__);
echo 
'Last changed at ' date('g:i a'$info->getCTime());
?>

以上例程的输出类似于:

Last changed at 1:49 pm

参见

add a noteadd a note

User Contributed Notes 1 note

up
6
michael at smith-li dot com
7 years ago
A file's ctime is it's inode change time. The inode changes when file metadata changes (for example when file permissions change). The inode also changes whenever the file's contents change, but since the inode changes for other reasons, it's more accurate to use mtime to get the age of the contents of a file. See SPLFileInfo::getMTime

Also, please note ctime is not creation time. (Most UNIX-like filesystems do not record a file's creation time.)

官方地址:https://www.php.net/manual/en/splfileinfo.getctime.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3