我想在其 DIV 标记内的图像“folderContents05.jpg”顶部显示文件夹内容。PHP 脚本应该输出它所在目录的文件夹内容。脚本本身可以正常工作,但是当我在 html 中使用它或调用脚本时,我似乎无法显示任何内容。
这是HTML-
<head>
<title>index</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="style.css" rel="stylesheet" type="text/css">
<!-- End Save for Web Styles -->
</head>
<body style="background-color:#353535; margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;">
<!-- Save for Web Slices (index.psd) -->
<div id="wrapper">
<div id="Table_01">
<div id="folderContents01">
<img src="images/folderContents01.jpg" width="359" height="120" alt="">
</div>
<div id="folderContents02">
<img src="images/folderContents02.jpg" width="591" height="150" alt="">
</div>
<div id="folderContents03">
<img src="images/folderContents03.jpg" width="359" height="30" alt="">
</div>
<div id="folderContents04">
<img src="images/folderContents04.jpg" width="126" height="460" alt="">
</div>
<div id="folderContents05">
<img src="images/folderContents05.jpg" width="698" height="396" alt="">
</div>
<div id="folderContents06">
<img src="images/folderContents06.jpg" width="126" height="460" alt="">
</div>
<div id="folderContents07">
<img src="images/folderContents07.jpg" width="698" height="64" alt="">
</div>
<div id="folderContents08">
<img src="images/folderContents08.jpg" width="950" height="90" alt="">
</div>
</div>
</div>
<!-- End Save for Web Slices -->
</body>
</html>
和php脚本
<?php
$count = 0;
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {$count++;
print("<a href=\"".$file."\">".$file."</a><br />\n");
}
}
closedir($handle);
}
?>