Last active
April 7, 2020 06:26
-
-
Save KaiserWerk/13bfd40e10e8c853d1febe024a635ba3 to your computer and use it in GitHub Desktop.
Writing a PHP cache file using PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // reading data from any source | |
| $array = call_procedure_here(); | |
| $output = '<?php' . PHP_EOL . '$myarray = ' . var_export($array, true) . ';' . PHP_EOL . '?>'; | |
| file_put_contents(__DIR__ . '/cache/cache_file.php', $output); | |
| // include in other files | |
| include __DIR__ . '/cache/cache_file.php'; | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment