php获得文件的更新时间
php获得文件的更新时间 ```php/* * @param string $file Filepath * @param string $format dateformat * @link http://www.php.net/manual/de/function.date.php * @link http://www.php.net/manual/de/function.filemtime.php
/* * @param string $file Filepath * @param string $format dateformat * @link http://www.php.net/manual/de/function.date.php * @link http://www.php.net/manual/de/function.filemtime.php * @return string|bool Date or Boolean */ function getFiledate($file, $format) { if (is_file($file)) { $filePath = $file; if (!realpath($filePath)) { $filePath = $_SERVER["DOCUMENT_ROOT"].$filePath; } $fileDate = filemtime($filePath); if ($fileDate) { $fileDate = date("$format",$fileDate); return $fileDate; } return false; } return false; }
- 上一篇:PHP 文件上传代码示例
- 下一篇:php 遍历某文件夹下的所有文件和文件夹
精彩图集
精彩文章