📜  使用 wordlist php 代码示例的随机词

📅  最后修改于: 2022-03-11 14:53:48.650000             🧑  作者: Mango

代码示例1
// Read the whole file into a array.
$file = file('File Location');

// Getting the Words Count in the file.
$wCount = count($file);

// Printing out the random word.
echo $file[rand(0, $wCount - 1)];

// This is a one liner.
echo file('File Location')[rand(0, count(file('File Location')) - 1)];