PHP - 获取上传文件传输完成的时间戳

时间:2011-05-16 04:38:46

标签: php date time file ftp

是否可以将文件上传的日期提交给FTP? 未创建

它的使用将在我上传文件供客户端查看的系统中,该文件将显示在动态页面上,并且需要在上次更改时加上时间戳。

我基本上需要花时间将文件传输到FTP - 通过FTP客户端,由我上传。

1 个答案:

答案 0 :(得分:4)

使用PHP的stat()函数。它返回您需要知道的每个数据。

http://php.net/manual/en/function.stat.php

<?php
/* Get file stat */
$stat = stat('C:\php\php.exe');

/*
 * Print file access time, this is the same 
 * as calling fileatime()
 */
echo 'Access time: ' . $stat['atime'];

/*
 * Print file modification time, this is the 
 * same as calling filemtime()
 */
echo 'Modification time: ' . $stat['mtime'];

/* Print the device number */
echo 'Device number: ' . $stat['dev'];
?>

我认为在你的情况下“文件修改时间”就是答案。