vendredi 19 juillet 2019

Generate URL from random row in text file?

I have a plain text file with quotes, where each quote is on its own line (and nothing more). I display a random quote on a webpage with the following code.

<?php
$f_contents = file("quote.txt");
$line = $f_contents[array_rand($f_contents)];
echo $line
?>

Is it possible to generate a link to the random quote so that someone can find it again?




Aucun commentaire:

Enregistrer un commentaire