PHP ftp_mdtm() 函数

PHP 教程 · 2019-01-26 09:13:14

定义和用法

ftp_mdtm() 函数返回指定文件的最后修改时间。

该函数将以 Unix 时间戳的形式返回文件的最后修改时间,如果出错则返回 -1。

语法

int ftp_mdtm ( resource $ftp_stream , string $remote_file )

参数 描述
ftp_connection 必需。规定要登录的 FTP 连接。
file 必需。规定要检查的文件。

提示和注释

注释:并非所有 FTP 服务器都支持该函数。

实例

<?php
$file = 'somefile.txt';

// 连接到服务器
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

//  获取最好修改时间
$buff = ftp_mdtm($conn_id, $file);
// 如果成功返回一个 UNIX 时间戳,否则返回 -1。
if ($buff != -1) {
    // 输出 somefile.txt 最后的修改时间
    echo "$file 最好修改时间为 : " . date ("F d Y H:i:s.", $buff);
} else {
    echo "无法获取文件的修改时间";
}

// 关闭连接
ftp_close($conn_id);
?>

点击查看所有 PHP 教程 文章: https://www.codercto.com/courses/l/5.html

查看所有标签

Ethnography and Virtual Worlds

Ethnography and Virtual Worlds

Tom Boellstorff、Bonnie Nardi、Celia Pearce、T. L. Taylor / Princeton University Press / 2012-9-16 / GBP 21.00

"Ethnography and Virtual Worlds" is the only book of its kind - a concise, comprehensive, and practical guide for students, teachers, designers, and scholars interested in using ethnographic methods t......一起来看看 《Ethnography and Virtual Worlds》 这本书的介绍吧!

SHA 加密
SHA 加密

SHA 加密工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具