Reputation: 179
I am working for a PHP project that retrieves file meta information. All I know are filename, file size, date modified.
Anybody knows the other meta information that can I get into a file using PHP? If there are, would you write down the PHP code?
Upvotes: 0
Views: 126
Reputation: 26732
If you are asking for meta tags info, use get_meta_tags()
to retrieve all meta information.
<?php
// Assuming the above tags are at www.example.com
$tags = get_meta_tags('http://www.example.com/');
// Notice how the keys are all lowercase now, and
// how . was replaced by _ in the key.
echo $tags['author']; // name
echo $tags['keywords']; // php documentation
echo $tags['description']; // a php manual
echo $tags['geo_position']; // 49.33;-86.59
?>
NEW EDIT --
For File Info, you can use fstat()
method --
fstat — Gets information about a file using an open file pointer
<?php
// open a file
$fp = fopen("/etc/passwd", "r");
// gather statistics
$fstat = fstat($fp);
// close the file
fclose($fp);
// print only the associative part
print_r(array_slice($fstat, 13));
?>
OUTPUT
-
Array
(
[dev] => 771
[ino] => 488704
[mode] => 33188
[nlink] => 1
[uid] => 0
[gid] => 0
[rdev] => 0
[size] => 1114
[atime] => 1061067181
[mtime] => 1056136526
[ctime] => 1056136526
[blksize] => 4096
[blocks] => 8
)
Upvotes: 1