<?php
    $url = 'https://v.api.aa1.cn/api/yiyan/index.php';
    $response = file_get_contents($url); //获取接口内容
    $data = json_decode($response, true); //将返回的HTML格式数据转化为数组
?>
<!DOCTYPE html>
<html>
<head>
    <title>PHP 获取一言 API 数据并展示</title>
    <style>
        body {
            font-size: 20px;
            font-family: '微软雅黑';
            background-color: #f5f5f5;
        }
        p {
            padding: 20px;
            border: 1px solid #ccc;
            border-radius: 5px;
            background-color: #fff;
            box-shadow: 0 0 10px #ccc;
            text-align: center;
            margin: 50px auto;
            max-width: 800px;
        }
    </style>
</head>
<body>
    <p><?php echo $data['responseText']; ?></p>
</body>
</html>

原文地址: http://www.cveoy.top/t/topic/l44r 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录