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)];' ? –