mirror of
https://github.com/LyLme/lylme_spage.git
synced 2024-11-17 14:34:08 +08:00
修复随机一言部分环境报错
This commit is contained in:
parent
601accf7a7
commit
dd42385b21
@ -212,6 +212,9 @@ function get_real_ip()
|
||||
function yan()
|
||||
{
|
||||
$filename = ROOT . '/assets/data/data.dat';
|
||||
if (!file_exists($filename) || !is_readable($filename)) {
|
||||
die(' 一言数据文件不存在或不可读');
|
||||
}
|
||||
$data = file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
// 随机获取一行索引
|
||||
$result = $data[array_rand($data)];
|
||||
|
Loading…
Reference in New Issue
Block a user