Registrieren Anmelden
n/program · 2024-06-04 · 458 Aufrufe
u/cnhunkeSilber
n/programu/cnhunke · 2024-06-04

一言语录API源码

一言语录API源码
修改file=file($path."这里放文本路径")
演示站:https://api.xfyun.club/yiyan.php
话不多说直接放代码:
<?php
$path = dirname(~~~~FILE);
$file = file($path . "/yiyan/yiyan.txt");
$arr = mt_rand(0, count($file) - 1);
$content = trim($file[$arr]);

if (isset($*~~~~GET['charset']) && !empty($*GET['charset'])) {
$charset = $_GET['charset'];
if (strcasecmp($charset, "gbk") == 0) {
$content = mb_convert_encoding($content, 'gbk', 'utf-8');
}
} else {
$charset = 'utf-8';
}

header("Content-Type: text/html; charset=$charset");
if ($_GET['format'] === 'js') {
echo "function misaka(){document.write('" . $content . "');}";
} else {
echo $content;
}

0
4
Anmelden, um mitzudiskutieren.

4 Antworten

Sortierung
  1. Speeeed 📚 Platin 2 Jahre 2024-06-04

    好东西。感谢分享。哈哈。我用的是小韩家的。

    0
  2. jzhfg Steinreich Meister MANAGER 2024-06-04

    目前用不到也要顶一下收藏,感谢分享

    0
  3. zhuli8 Silber 2024-06-04

    @"金子会发光"#p34481 怎么哪里都有你,那么水的吗,哈哈哈哈。

    0
  4. jzhfg Steinreich Meister MANAGER 2024-06-04

    @"zhuli8"#p34485 我在看着你们呢:huaji46:就像我说的奋斗组是勤奋出来的也可以说是水但是不能真水 :ac01:

    0