1
カンマで区切られた単語のファイルからランダムな単語を選ぶにはどうすればよいですか?それはコードの最小量であるPHPのテキストファイルからランダムな単語を選んでください。
カンマで区切られた単語のファイルからランダムな単語を選ぶにはどうすればよいですか?それはコードの最小量であるPHPのテキストファイルからランダムな単語を選んでください。
$var = file_get_contents('the_file.txt'); //Take the contents from the file to the variable
$result = explode(',',$var); //Split it by ','
echo = $result[array_rand($result)]; //Return a random entry from the array.
echo explode(',',file_get_contents('file.txt'))[rand(0,99)];
。
'echo = $ result [array_rand($ result)];' ? –