每日60秒新闻早报单页文字版HTML源码
核心提示:?php$url = 'https://api.afx5.cn/api/mrzb';$response = file_get_contents($url);$data = json_decode($response, true);if ($
- <?php
- $url = 'https://api.afx5.cn/api/mrzb';
- $response = file_get_contents($url);
- $data = json_decode($response, true);
- if ($data['code'] == 200) {
- $headImage = $data['data']['head_image'];
- $date = $data['data']['date'];
- $news = $data['data']['news'];
- $weiyu = $data['data']['weiyu'];
- $cacheDir = '60s';
- $headImageFile = $cacheDir . '/' . basename($headImage);
- if (!file_exists($cacheDir)) {
- mkdir($cacheDir, 0777, true);
- }
- if (!file_exists($headImageFile)) {
- $ch = curl_init($headImage);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3');
- $imageData = curl_exec($ch);
- curl_close($ch);
- file_put_contents($headImageFile, $imageData);
- }
- } else {
- echo "<p>获取数据失败,请稍后再试。</p>";
- exit;
- }
- ?>
- <!DOCTYPE html>
- <html lang="zh-CN">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>每日新闻早报</title>
- <style>
- body {
- font-family: Arial, sans-serif;
- margin: 0;
- padding: 0;
- display: flex;
- flex-direction: column;
- align-items: center;
- }
- .container {
- width: 90%;
- max-width: 800px;
- margin: 20px auto;
- padding: 20px;
- border-radius: 8px;
- box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
- }
- .header img {
- width: 100%;
- height: auto;
- border-radius: 8px;
- }
- h1 {
- text-align: center;
- margin: 20px 0;
- }
- ul {
- list-style-type: none;
- padding: 0;
- }
- li {
- background-color: #fff;
- padding: 10px;
- border-radius: 8px;
- }
- .weiyu {
- text-align: center;
- font-style: italic;
- margin-top: 20px;
- }
- </style>
- </head>
- <body>
- <div class="container">
- <div class="header">
- <img src=https://www.rom333.com/"<?php echo $headImageFile; ?>">
- </div>
- <h1><?php echo $date; ?> 新闻早报</h1>
- <ul>
- <?php foreach ($news as $newsItem): ?>
- <li><?php echo $newsItem; ?></li>
- <?php endforeach; ?>
- </ul>
- <p class="weiyu"><?php echo $weiyu; ?></p>
- </div>
- </body>
特别提示:本信息由相关用户自行提供,真实性未证实,仅供参考。请谨慎采用,风险自负。