ฟังก์ชัน stat()
หาข้อมูลของไฟล์ ด้วยฟังก์ชัน stat()

รูปแบบ
stat(file)
file คือ path ที่อยู่

ฟังก์ชันจะ return ค่าเป็น array โดยมี element ดังนี้
[0] หรือ [dev] คือ Device number
[1] หรือ [ino] คือ Inode number
[2] หรือ [mode] คือ Inode protection mode
[3] หรือ [nlink] คือ Number of links
[4] หรือ [uid] คือ User ID of owner
[5] หรือ [gid] คือ Group ID of owner
[6] หรือ [rdev] คือ Inode device type
[7] หรือ [size] คือ Size in bytes
[8] หรือ [atime] คือ Last access (รูปแบบ Unix timestamp)
[9] หรือ [mtime] คือ Last modified (รูปแบบ Unix timestamp)
[10] หรือ [ctime] คือ Last inode change (รูปแบบ Unix timestamp)
[11] หรือ [blksize] คือ Blocksize of filesystem IO (if supported)
[12] หรือ [blocks] คือ Number of blocks allocated

 

ตัวอย่าง
<?php

$arrayInfo=stat("c:\\test.txt");
print_r($arrayInfo);

?>

ผลลัพธ์
Array (
[0] => 2
[1] => 0
[2] => 33206
[3] => 1
[4] => 0
[5] => 0
[6] => 2
[7] => 0
[8] => 1287163319
[9] => 1287163319
[10] => 1287163319
[11] => -1
[12] => -1
[dev] => 2
[ino] => 0
[mode] => 33206
[nlink] => 1
[uid] => 0
[gid] => 0
[rdev] => 2
[size] => 0
[atime] => 1287163319
[mtime] => 1287163319
[ctime] => 1287163319
[blksize] => -1
[blocks] => -1
)


กลับ menu php