开发者

Simple PHP Image Scroller

开发者 https://www.devze.com 2023-01-28 15:57 出处:网络
I\'m very new to PHP and I\'m trying to build a simple image scroll-through which would consist of the picture as well as a next link and a previous link which would go to the next/previous pictures开

I'm very new to PHP and I'm trying to build a simple image scroll-through which would consist of the picture as well as a next link and a previous link which would go to the next/previous pictures开发者_StackOverflow社区 stored in a directory. Right now all I have is an array of the filenames.

I did a bit of searching and haven't found any tutorials on doing this, but does anyone know of any links where I might find some help? Thanks.


well you could link the array index through get and then use it as key to show the url of the image

foreach($array as $k=>$v){

echo '<a href="'.$_SERVER['PHP_SELF'].'?index='.$k.'"></a>';//creates the link for diffrent images
}

echo '<img src="'.$array[$_GET['index']].'"/>';//show the image
0

精彩评论

暂无评论...
验证码 换一张
取 消