搭建随机图片API
- 开发
- 2023-08-04
- 5237热度
- 6评论
主要是本地随机图片 首先创建一个文件夹 photos 和一个名为 api.php 的文件 然后在photos的文件夹内放图片,在api.php内编写如下代码
<?php
$img_array = glob("photos/*.{gif,jpg,png}",GLOB_BRACE);
$img = array_rand($img_array);
$a = $img_array[$img];
header("Location:".$a);
?>
然后直接访问api.php就行了,每次访问的图片是随机的。
演示:http://swq111.online/jpg/api.php
像我的博客的背景每次刷新都是随机的
Hi, I do believe this is an excellent web
site. I stumbledupon it 😉 I will come back yet again since I book-marked it.
Money and freedom is the best way to change, may you
be rich and continue to help others.
Wonderful article! That is the type of information that should be shared around the net.
Shame on Google for now not positioning this post higher!
Come on over and visit my website . Thanks =)
Aw, this was an exceptionally good post. Spending some time and actual
effort to create a superb article… but what can I say… I procrastinate a whole lot
and never seem to get anything done.
Good post. I learn something new and challenging on blogs I stumbleupon on a daily basis.
It will always be helpful to read through articles from other authors and use something from other
websites.
social proof social proof.
Hey people!!!!!
Good mood and good luck to everyone!!!!!