Source Storage
css源:https://source.ahdark.com/typecho/theme/handsome/8.3.0/assets/

使用mirlkoi图库的api随机头图
官网:https://iw233.cn/main.html

打开/usr/themes/handsome/libs/Content.php文件找到whenSwitchHeaderImgSrc函数附近
注释掉

$randomNum = unserialize(INDEX_IMAGE_ARRAY);和$random = THEME_URL . 'usr/img/sj/' . @$randomNum[$index] . '.jpg'; 添加$random = 'https://iw233.cn/API/Random.php?rand=' . @$randomNum[$index] 或者 添加一行$random = '/api/get_img.php?rand=' . @$randomNum[$index];
/api/get_img.php文件内容

<?php
error_reporting(0);
header("Access-Control-Allow-Origin:*");
$data = curl_get('https://iw233.cn/API/Random.php?type=json');
if ($arr = json_decode($data,true)) {
    header("Location:".$arr['pic']);
}
function curl_get($url)
{
    $ch = curl_init($url);
    $httpheader[] = "Accept: */*";
    $httpheader[] = "Accept-Language: zh-CN,zh;q=0.8";
    $httpheader[] = "Connection: close";
    curl_setopt($ch, CURLOPT_HTTPHEADER, $httpheader);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Linux; U; Android 4.4.1; zh-cn; R815T Build/JOP40D) AppleWebKit/533.1 (KHTML, like Gecko)Version/4.0 MQQBrowser/4.5 Mobile Safari/533.1');
    curl_setopt($ch, CURLOPT_TIMEOUT, 5);
    $content = curl_exec($ch);
    curl_close($ch);
    return $content;
}
Last modification:February 2, 2022
如果觉得我的文章对你有用,请随意赞赏