0
ftp의 폴더에서 파일을 가져 오는 동안 내 타임 스탬프에서 정확한 날짜를 가져 오는 데 문제가 있습니다.날짜를 타임 스탬프로 변환하면 PHP에서 잘못된 날짜가 표시됩니다.
$it = new DirectoryIterator("blahblahblah/news");
$files = array();
foreach($it as $file) {
if (!$it->isDot()) {
$files[] = array($file->getMTime(), $file->getFilename());
}}
rsort($files);
foreach ($files as $f) {
$mil = $f[0];
$seconds = $mil/1000;
$seconds = round($seconds);
$theDate = date("d/m/Y", $seconds);
echo "<img src=\"images/content/social-icons/article.png\" width=\"18\" height=\"19\" alt=\"article\">" . $theDate . "- <a style=\"background-color:transparent;\" href=\"news/$f[1]\">" . $f[1] . "</a>";
echo "<br>";
}
파일을 타임 스탬프로 정렬 한 다음 파일 이름과 파일에 대한 링크를 표시합니다. 문제는 date()가 1970 년 1 월 16 일에 나왔다는 것입니다 ... 타임 스탬프를 온라인 변환기에 넣었고 정확하기 때문에 혼란 스럽습니다. 나는 또한 타임 스탬프를 반올림했지만 도움이되지 않습니다.
챔피언! 정말 고마워! – user482024