CakeFest 2024: The Official CakePHP Conference

SplFileInfo::getCTime

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

SplFileInfo::getCTimeObtiene el i-nodo de el cambio de tiempo

Descripción

public SplFileInfo::getCTime(): int|false

Devuelve el i-nodo de el cambio de tiempo para el fichero. El tiempo es retornado en formato Unix timestamp.

Parámetros

Esta función no tiene parámetros.

Valores devueltos

El último cambio del tiempo, en formato Unix timestamp en caso de éxito, o false en caso de error.

Errores/Excepciones

Lanza una RuntimeException en caso de error.

Ejemplos

Ejemplo #1 Ejemplo de SplFileInfo::getCTime()

<?php
$info
= new SplFileInfo('example.jpg');
echo
'El último cambio ' . date('g:i a', $info->getCTime());
?>

El resultado del ejemplo sería algo similar a:

El último cambio 1:49 pm

Ver también

add a note

User Contributed Notes 1 note

up
8
michael at smith-li dot com
9 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.)
To Top