Is it possible to do this: there is a folder (games) with many pages

and the page (site1.php), the task is to display the name and variables of all pages from the folder (games) on the site1.php page and display it all in a list on the site1.php page, where each displayed page corresponds to its variable

ps I read about the fact that you can display only the name of the page (file) from the folder, but how to get along with the name and variables, is it possible? Or without MySQL can not do here?

enter image description here

  • 2
    What do you mean by "variables"? - ArchDemon
  • In each page of the folder there are several variables of the type "$ example = 'some word, for example the description'" - Daniel

1 answer 1

<?php echo "<pre>"; $cdir = scandir('папка'); foreach ($cdir as $key => $value) { if (!in_array($value, array(".", ".."))) { $current = $dir . DIRECTORY_SEPARATOR . $value; if (is_file($current)) { echo $value . PHP_EOL; echo "========================" . PHP_EOL; // здесь, как то тянуть переменные echo file_get_contents($current) . PHP_EOL . PHP_EOL; } } } echo "</pre>";