1. 先准备好自己的随机图链接

2. 进入\usr\themes\handsome\libs\Content.php 页面
替换下面代码,图片地址自己修改
8.4版本在539行附近

$randomNum = unserialize(INDEX_IMAGE_ARRAY);  
 // 随机缩略图路径
srand( microtime() * 1000000 );
$num = rand( 1, 45 );
switch( $num )
{
case 1: $image_file = "https://tva1.sinaimg.cn/mw690/00828lbuly1gk5xjus4lzj31hc0u0ds9.jpg";break;
case 2: $image_file = "https://tva1.sinaimg.cn/mw690/00828lbuly1gk5xjusopaj31hc0u0491.jpg";break;
case 3: $image_file = "https://tva1.sinaimg.cn/mw690/00828lbuly1gk5xk2w0f4j31hc0u0qi9.jpg";break;
case 4: $image_file = "https://tva1.sinaimg.cn/mw690/00828lbuly1gk5xjuuqz5j31hc0u0wre.jpg";break;
case 5: $image_file = "https://tva1.sinaimg.cn/mw690/00828lbuly1gk5xk2ep96j31hc0u0ncd.jpg";break;
case 6: $image_file = "https://tva1.sinaimg.cn/mw690/00828lbuly1gk5xk2vux9j31hc0u01di.jpg";break;
};
// 随机缩略图路径
//  $random = STATIC_PATH . 'img/sj/' . @$randomNum[$index] . '.jpg';
    $random = $image_file;        
    $pattern = '/\<img.*?src\=\"(.*?)\"[^>]*>/i';
        $patternMD = '/\!\[.*?\]\((http(s)?:\/\/.*?(jpg|png|JPEG|webp|jpeg|bmp|gif))/i';
        $patternMDfoot = '/\[.*?\]:\s*(http(s)?:\/\/.*?(jpg|png|JPEG|webp|jpeg|bmp|gif))/i';

3.后台-博客头图来源设置-1只显示随机图片

来源:旧时繁华

最后修改:2022 年 03 月 31 日
如果觉得我的文章对你有用,请随意赞赏