0
0

index.php 985 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 Examples</title>
  10. </head>
  11. <body>
  12. <?php
  13. $exampleTypeList = glob('./*',GLOB_ONLYDIR);
  14. foreach($exampleTypeList as $exampleType) {
  15. echo '<h1>PHPExcel ' . pathinfo($exampleType,PATHINFO_BASENAME) . ' Examples</h1>';
  16. $exampleList = glob('./'.$exampleType.'/*.php');
  17. foreach($exampleList as $exampleFile) {
  18. $fileData = file_get_contents($exampleFile);
  19. $h1Pattern = '#<h1>(.*?)</h1>#';
  20. $h2Pattern = '#<h2>(.*?)</h2>#';
  21. if (preg_match($h1Pattern, $fileData, $out)) {
  22. $h1Text = $out[1];
  23. $h2Text = (preg_match($h2Pattern, $fileData, $out)) ? $out[1] : '';
  24. echo '<a href="',$exampleFile,'">',$h1Text,'</a><br />';
  25. if (($h2Text > '') &&
  26. (pathinfo($exampleType,PATHINFO_BASENAME) != 'Calculations')) {
  27. echo $h2Text,'<br />';
  28. }
  29. }
  30. }
  31. }
  32. ?>
  33. <body>
  34. </html>