fileatime ක්රියාකාරීත්වය
fileatime ක්රියාකාරීත්වය ගොනුවකට අවසන් ප්රවේශ වේලාව Unix timestamp ලෙස ආපසු ලබා දෙයි. පරාමිතියට ගොනුවට මාර්ගය ලබා දේ. ගොනුව නොපවතී නම්, ක්රියාකාරීත්වය false ආපසු ලබා දෙයි.
වාක්ය රචනය
fileatime(string $filename): int|false
උදාහරණය
ගොනුවකට අවසන් ප්රවේශ වේලාව ලබා ගනිමු:
<?php
$res = fileatime('test.txt');
echo $res;
?>
කේතය ක්රියාත්මක කිරීමේ ප්රතිඵලය:
1672531200
උදාහරණය
ප්රවේශ වේලාව ලබා ගැනීමට පෙර ගොනුවේ පැවැත්ම පරීක්ෂා කරමු:
<?php
$filename = 'nonexistent.txt';
if (file_exists($filename)) {
echo fileatime($filename);
} else {
echo 'File not found';
}
?>
කේතය ක්රියාත්මක කිරීමේ ප්රතිඵලය:
'File not found'
උදාහරණය
Unix timestamp කියවිය හැකි ආකෘතියකට පරිවර්තනය කරමු:
<?php
$timestamp = fileatime('test.txt');
echo date('Y-m-d H:i:s', $timestamp);
?>
කේතය ක්රියාත්මක කිරීමේ ප්රතිඵලය:
'2023-01-01 00:00:00'