PHP:如何获取文件创建日期? [英] PHP: how can I get file creation date?

查看:91
本文介绍了PHP:如何获取文件创建日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我如何获取文件的创建日期。我没有看到任何直接的功能。



filemtime



如果文件未被修改,会发生什么?

解决方案

使用 fllectime 。对于Windows,它将返回创建时间,对于Unix 更改时间,这是最好的,因为在Unix上没有创建时间(在大多数文件系统中)。


还要注意,在一些Unix文本中,文件的
ctime被称为
作为创建时间的文件。
这是错误的。大多数Unix
文件系统中Unix文件没有创建
时间。



I am reading a folder with lots of files.

How can I get the creation date of a file. I don't see any direct function to get it.

There are filemtime and filectime.

And if the file hasn't been modified, what will happen?

解决方案

Use filectime. For Windows it will return the creation time, and for Unix the change time which is the best you can get because on Unix there is no creation time (in most filesystems).

Note also that in some Unix texts the ctime of a file is referred to as being the creation time of the file. This is wrong. There is no creation time for Unix files in most Unix filesystems.

这篇关于PHP:如何获取文件创建日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆