index.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. error_reporting(E_ALL);
  3. set_time_limit(0);
  4. date_default_timezone_set('Europe/London');
  5. ?>
  6. <html>
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  9. <title>PHPExcel Calculation Function Examples</title>
  10. </head>
  11. <body>
  12. <?php
  13. echo '<h1>PHPExcel Calculation Function Examples</h1>';
  14. $exampleTypeList = glob('./*',GLOB_ONLYDIR);
  15. foreach($exampleTypeList as $exampleType) {
  16. echo '<h2>' . pathinfo($exampleType,PATHINFO_BASENAME) . ' Function Examples</h2>';
  17. $exampleList = glob('./'.$exampleType.'/*.php');
  18. foreach($exampleList as $exampleFile) {
  19. $fileData = file_get_contents($exampleFile);
  20. $h1Pattern = '#<h1>(.*?)</h1>#';
  21. $h2Pattern = '#<h2>(.*?)</h2>#';
  22. if (preg_match($h1Pattern, $fileData, $out)) {
  23. $h1Text = $out[1];
  24. $h2Text = (preg_match($h2Pattern, $fileData, $out)) ? $out[1] : '';
  25. echo '<a href="',$exampleFile,'">',$h1Text,'</a><br />';
  26. if ($h2Text > '') {
  27. echo $h2Text,'<br />';
  28. }
  29. }
  30. }
  31. }
  32. ?>
  33. <body>
  34. </html>