更新1.8.0版本

This commit is contained in:
LyLme 2023-12-19 00:33:19 +08:00
parent 9eab67a909
commit 601accf7a7

View File

@ -212,16 +212,12 @@ function get_real_ip()
function yan() function yan()
{ {
$filename = ROOT . '/assets/data/data.dat'; $filename = ROOT . '/assets/data/data.dat';
//随机一言文件路径 $data = file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
if (file_exists($filename)) { // 随机获取一行索引
$data = explode(PHP_EOL, file_get_contents($filename)); $result = $data[array_rand($data)];
// $result = str_replace(array( // 去除多余的换行符
// "\r", $result = str_replace(["\r", "\n", "\r\n"], '', $result);
// "\n", return $result;
// "\r\n"
// ), '', $data[array_rand($data)]);
return $data[array_rand($data)];
}
} }
function rearr($data, $arr) function rearr($data, $arr)
{ {