ez-site/apis/onesay.php
2024-10-19 21:33:47 +08:00

34 lines
1.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// 定义一个关联数组,包含名言和它们的作者
$quotes = [
"这个年龄抽烟,不是装逼就是二逼" => "秦涛",
"天涯何处无芳草,何必要在身边找,本来数量就不多,质量还不咋地" => "秦涛",
"弱小和无知,不是生存的障碍,傲慢才是" => "《三体》",
"你的无畏来源于无知" => "《三体》",
"要想逃避现实,最好的方式就是深深介入现实之中" => "《三体》",
"我爱你,与你有何相干?毁灭你,又与你有何相干?" => "《三体》",
"宇宙很大,生活更大,也许以后还有缘相见" => "《三体》",
"大多数人到死都没有向尘世之外瞥一眼" => "《三体》",
"碑是那么小,与其说是为了纪念,更像是为了忘却" => "《三体》",
"人们习惯将凡事分出黑与白,但很遗憾,现实全是灰色的" => "《三体》",
"没有不散的宴席,一切都有个尽头" => "《三体》",
"编程本身虽然是一种智力活动,但是中国的现实却更像一种体力劳动" => "《未来世界的幸存者》",
"我们只是让某些局部变得更有秩序,把混乱转移到另一些领域。" => "《未来世界的幸存者》",
"苦难就是苦难,苦难不会带来成功" => "《活着》",
"我的职业建议是任何工作要么让你学习learn要么让你赚钱earn。如果既学不到新东西又赚不到钱你就应该走了" => "Garry Tan",
"编程既不是短跑,也不是马拉松,而是日记。在日复一日的累积当中,完成你的事业" => "《四十年编程感想》"
];
$randomKey = array_rand($quotes);
$quote = $randomKey;
$author = $quotes[$randomKey];
// 创建一个数组来存储名言和作者信息
$response = [
'quote' => $quote,
'author' => $author
];
// 将数组转换为 JSON 格式并输出
echo json_encode($response);