虚拟主机目录下新建PHP文件填写下面代码
<?php
$img_array = glob('img/*.{gif,jpg,png,jpeg,webp,bmp}', GLOB_BRACE);
if(count($img_array) == 0) die('没有找到图片文件。MuaOoO ~ '.dirname(__FILE__).'/img/ 文件夹');
header('Content-Type: image/png');
echo(file_get_contents($img_array[array_rand($img_array)]));
?>
随机图片