如何使用 PHP 在文件名旁边添加文件大小???
目前使用这个:
<?php
# Configuration
$show_path = 0; # Show local path.
$show_dotdirs = 1; # Show '.' and '..'.
$path = substr($_SERVER['SCRIPT_FILENAME'], 0,
strrpos($_SERVER['SCRIPT_FILENAME'], '/') + 1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>
<div id="menu">
<div id="menualign"><a href="index.php"><img src="images/home.png" onmouseover="src='images/homed.png'" onmouseout="src='images/home.png'"/></a><img src="images/moviesa.png"/><a href="tvguide.php"><img src="images/tv.png" onmouseover="src='images/tvd.png'" onmouseout="src='images/tv.png'"/></a></div>
</div>
<div id="container">
<div id="fleft">
<table cellspacing="1">
<tr>
<th><?php if ($show_path == 1) { echo $path; } else { echo 'Current Movies'; } ?></th>
</tr>
<tr>
<td align="left"><?php
$dirs = array();
$files = array();
$dir = dir('../Movies/');
while ($entry = $dir->read()) {
if (($entry != '.') and (substr($entry, -4) != '.php')) {
if (is_dir($entry)) {
if (($entry != '..') or $show_dotdirs){
$dirs[] = $entry;
}
} else {
$files[] = $entry;
}
}
}
$dir->close();
sort($dirs);
foreach ($dirs as $dir) {
printf('<strong><</strong> <a href="%s">%s</a> <strong>></strong><br />' . "\n", $dir, $dir);
}
sort($files);
foreach ($files as $file) {
printf('<hr />%s<br />' . "\n", $file, $file);
}
?></td>
</tr>
</table>
</div>
<div id="fright">TEST
</div>
</div>
</body>
</html>
输出如下:http ://downunderpctech.com/output.png
我想为文件大小添加一个部分
可能使用相同的代码,但收集文件大小信息作为文件名但在它旁边的一个新的
我不太关心文件大小输出,但更喜欢只输出 KB
谢谢,亚当