Code for calling and randomizing contents of a .txt?
-
Hello,
I am looking to call the contents of a .txt document and randomize those contents.
I think I found the php code that might work. Would something like this be correct?
$f_contents = file("TheRandomContent.txt"); print_r($f_contents); //$line = $f_contents[array_rand($f_contents)]; //echo $line;
If that is correct, then how can I alter it to call the document if it’s located say here:
<src="https://TheWebSite.com/wp-content/uploads/2012/07/TheRandomContent.txt"
Am I on the right track here?
And, if so, how can I incorporate this in to the first code I listed? I’m a real beginner, so I’m kindly asking for specifics, please.
Thanks in advance for your help!
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Code for calling and randomizing contents of a .txt?’ is closed to new replies.