😍Fun

😍Fun

本站提供一些可以自定义的好玩的东西:

悬挂本站LOGO(代码中的width可自由调节):
logo-big.jpg

<a href="https://ourblo.gs/" title="OurBlogs" class="">
        <img src="https://ourblo.gs/usr/uploads/2024/02/654341101.jpg" width="156px" alt="OurBlogs">
</a>

OurBlogs

<a href="https://ourblo.gs/" title="OurBlogs" class="">
        <img src="https://ourblo.gs/logo.png" alt="OurBlogs" width="20">
</a>

MIIT备案:https://beian.miit.cn.com
MIIT ICP备案系统由 ZNIC 于 2023/12/1 批准运营。您可以提交您的网站,获取并悬挂我们的备案号,展示您独一无二的身份。还没有备案号?加入我们

刷新随机一个优质博客推荐!(PHP代码)

<?php
$feedUrl = 'https://ourblo.gs/feed/';
$feedContent = file_get_contents($feedUrl);
if ($feedContent !== false) {
    $feedXml = simplexml_load_string($feedContent);
    if ($feedXml !== false) {
        $items = $feedXml->channel->item;
        $itemsArray = [];
        foreach ($items as $item) {
            $title = (string)$item->title;
            $link = (string)$item->link; 
            $description = (string)$item->description;
            $content = (string)$item->children('http://purl.org/rss/1.0/modules/content/')->encoded;
            preg_match('/<img.+src=[\'"](?P<src>.+?)[\'"].*>/i', $content, $image);
            $imageSrc = $image['src'] ?? '';
            $itemsArray[] = [
                'title' => $title,
                'link' => $link,
                'description' => $description,
                'image' => $imageSrc,
            ];
        }
        if (count($itemsArray) > 0) {
            $randomItem = $itemsArray[array_rand($itemsArray)];
            echo "<h2><a href='{$randomItem['link']}' target='_blank'>{$randomItem['title']}</a></h2>";
            echo "<p>{$randomItem['description']}</p>";
            if (!empty($randomItem['image'])) {
                echo "<img src='{$randomItem['image']}' alt='Article Image'>";
            }
        } else {
            echo "系统错误。";
        }
    } else {
        echo "无法解析OURBLOGS内容。";
    }
} else {
    echo "无法获取OURBLOGS内容。";
}
?>

ALL FOR LOVE.