首先创建一个名为img的文件夹放入图片,然后创建一个名为api.php的文件放入下面的代码。
用的时候只需要直接访问api.php文件即可。
<?php
$img_array = glob("img/*.{gif,jpg,png}",GLOB_BRACE);
$img = array_rand($img_array);
$dz = $img_array[$img];
header("Location:".$dz);
?>
本站文章大部分为原创,用于个人学习记录,可能对您有所帮助,仅供参考!

