随机图片PHP

技术
240 0

用下面的代码保存为index.php

<?php 
$img=file('img.txt');
$url=array_rand($img);
header("Location:".$img[$url]); 
?>

在同级目录创建img.txt,一行一个图片链接。然后访问index.php即可。

https://cdn.jsdelivr.net/gh/tdrme/tdrme.github.io@master/20211201120150257.jpg
https://cdn.jsdelivr.net/gh/tdrme/tdrme.github.io@master/20211201120150249.jpg
https://cdn.jsdelivr.net/gh/tdrme/tdrme.github.io@master/20211201120034801.jpg
最后更新 2023-06-10
评论 ( 0 )
OωO
隐私评论