Randomly select file in PHP -


I use the 'included' keyword in php to select a file randomly from a file and output the content Want to do How do I do this?

Thank you.

Assuming that the folder is where the files and files are PHP files:

  $ phpFiles = glob ('/ path / to / files / * .php'); If (empty ($ phpFiles) === incorrect) {$ randomFile = $ phpFiles [array_rand ($ phpFiles)]; ($ RandomFile); }  

Comments