index.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. //header("Access-Control-Allow-Origin: http://localhost:4200");
  3. //header("Access-Control-Allow-Headers: Content-Type, Authorization");
  4. //header("Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE, OPTIONS");
  5. $pubPath = realpath(dirname(__FILE__));
  6. $appPath = realpath($pubPath . '/../app');
  7. $libPath = realpath($pubPath . '/../lib');
  8. $varPath = realpath($pubPath . '/../var');
  9. set_include_path(implode(PATH_SEPARATOR, array($appPath, $libPath, get_include_path())));
  10. if (isset($_SERVER['N2N_STAGE'])) {
  11. define('N2N_STAGE', $_SERVER['N2N_STAGE']);
  12. }
  13. // require __DIR__ . '/../vendor/autoload.php';
  14. require_once '../vendor/n2n/n2n/src/app/n2n/core/TypeLoader.php';
  15. n2n\core\TypeLoader::register(true,
  16. require __DIR__ . '/../vendor/composer/autoload_psr4.php',
  17. require __DIR__ . '/../vendor/composer/autoload_classmap.php');
  18. n2n\core\N2N::initialize($pubPath, $varPath, new n2n\core\FileN2nCache());
  19. n2n\core\N2N::autoInvokeControllers();
  20. n2n\core\N2N::finalize();
  21. function test($value) {
  22. if (!n2n\core\N2N::isLiveStageOn()) {
  23. echo "\r\n<pre>\r\n";
  24. var_dump($value);
  25. if (is_scalar($value)) echo "\r\n";
  26. echo "</pre>\r\n";
  27. }
  28. }
  29. // n2n\core\N2N::getPdoPool()->getPdo()->getLogger()->dump();