我必须显示文件中提供的图像名称。说image.txt
然后将这些图像作为链接。单击链接时,将显示另一组图像,该图像位于imagename.txt
(例如“ 1.jpg.txt
”)文件中。
请告诉如何去做。
用于显示图像的功能:
function imageDisplay($fileName)
{
$readfile = file($fileName);
// Create a loop that will read all elements of the array and print out
// each field of the tab-delimited text file
$fh = fopen($fileName, "rb") or exit("Unable to open file!");
$count =10;
for ($k=0; $k<=$count; $k++)
{
list($imageName) = fscanf($fh,"%s");
$path = "images/";
$path = trim($path.$imageName);
?>
<body bgcolor="gray">
<img src="<? echo $path; ?>" alt="<? echo $path; ?> " vspace="5" hspace="10" />
<?php
}
fclose($fh);
}
谢谢,拉维