- /*
- * @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;
- }
- //该片段来自于http://www.codesnippet.cn/detail/281120137584.html
来源: http://www.codesnippet.cn/detail/281120137584.html