Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Bạn thường muốn để khởi tạo các lĩnh vực nhất định và thậm chí kích hoạt thực hiện các phương pháp tìm thấy khi một đối tượng mới được khởi tạo. Không có gì sai trái với việc làm như vậy ngay lập tức sau khi instantiation, | 238 CHAPTER 10 WORKING WITH THE FILE AND OPERATING SYSTEM directory usr local apache2 htdocs book chapter10 totalSize round directory_size directory 1024 2 echo Directory directory . totalSize. kb. Access and Modification Times The ability to determine a file s last access and modification time plays an important role in many administrative tasks especially in Web applications that involve network or CPU-intensive update operations. PHP offers three functions for determining a file s access creation and last modification time all of which are introduced in this section. fileatimeO int fileatime string filename The fileatime function returns filename s last access time in Unix timestamp format or FALSE on error. An example follows php file usr local apache2 htdocs book chapter10 stat.php echo File last accessed .date m-d-y g i sa fileatime file This returns File last accessed 06-09-03 1 26 14pm filectime int filectime string filename The filectime function returns filename s last changed time in Unix timestamp format or FALSE on error. An example follows php file usr local apache2 htdocs book chapter10 stat.php echo File inode last changed .date m-d-y g i sa fileatime file This returns File inode last changed 06-09-03 1 26 14pm CHAPTER 10 WORKING WITH THE FILE AND OPERATING SYSTEM 239 Note The last changed time differs from the last modified time in that the last changed time refers to any change in the file s inode data including changes to permissions owner group or other inode-specific information whereas the last modified time refers to changes to the file s content specifically byte size . filemtimeO int filemtime string filename The filemtime function returns filename s last modification time in Unix timestamp format or FALSE otherwise. The following code demonstrates how to place a last modified timestamp on a Web page php file usr local apache2 htdocs book chapter10 stat.php echo File last updated .date m-d-y g i sa filemtime file This returns File last .