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

Mar*_*rty 6 php ftp time date file

是否可以获取文件上传到FTP 的日期?没有创建.

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

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

Tom*_*zyk 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'];
?>
Run Code Online (Sandbox Code Playgroud)

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