显示文件夹中的图像(幻灯片)

时间:2021-10-26 00:21:34

I have been trying to google and find out how to make a .php script that will make a an automatic slideshow of images from a folder, I've only managed to get the pictures to automatically show up on the php page, but I can't figure out how to make them slide one by one, like a slideshow.

我一直试图谷歌,并找出如何制作一个.php脚本,将自动幻灯片显示文件夹中的图像,我只是设法让图片自动显示在PHP页面上,但我可以弄清楚如何让它们一个一个地滑动,就像幻灯片一样。

Here is the url to the page where the images show up, so you can have a look Here is the code I've used.

这是显示图像的页面的URL,因此您可以查看以下是我使用过的代码。

<?
$files = glob("images/*.*");
for ($i=0; $i<count($files); $i++)
{
    $num = $files[$i];
    echo '<img src="'.$num.'" alt="random image" />'."<br><br>";
}
?>

Do you know how to make this happen? Or another way to do it? easier way? Java/XML?

你知道怎么做到这一点吗?还是另一种方式呢?更方便吗?的Java / XML?

1 个解决方案

#1


1  

To affect the client side, you'll need to use JavaScript. PHP only echos out static content on the server.

要影响客户端,您需要使用JavaScript。 PHP只回显服务器上的静态内容。

Here is a list of options you could use

以下是您可以使用的选项列表

#1


1  

To affect the client side, you'll need to use JavaScript. PHP only echos out static content on the server.

要影响客户端,您需要使用JavaScript。 PHP只回显服务器上的静态内容。

Here is a list of options you could use

以下是您可以使用的选项列表