web/app_dev.php line 52

Open in your IDE?
  1. <?php
  2. use Symfony\Component\ErrorHandler\Debug;
  3. use Symfony\Component\HttpFoundation\Request;
  4. // If you don't want to setup permissions the proper way, just uncomment the following PHP line
  5. // read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
  6. //umask(0000);
  7. // This check prevents access to debug front controllers that are deployed by accident to production servers.
  8. // Feel free to remove this, extend it, or make something more sophisticated.
  9. if (isset($_SERVER['HTTP_CLIENT_IP'])
  10.     || isset($_SERVER['HTTP_X_FORWARDED_FOR'])
  11.     || !(in_array(@$_SERVER['REMOTE_ADDR'], ['127.0.0.1''::1']) || 'cli-server' === php_sapi_name())
  12. ) {
  13.     if (!file_exists(__DIR__.'/../app/data/dev.lock')) {
  14.         header('HTTP/1.0 403 Forbidden');
  15.         exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
  16.     }
  17. }
  18. if (file_exists(__DIR__.'/../app/data/sync_template.lock')) {
  19.     $time file_get_contents(__DIR__.'/../app/data/sync_template.lock');
  20.     date_default_timezone_set('Asia/Shanghai');
  21.     $currentTime time();
  22.     if ($currentTime <= (int) $time) {
  23.         header('Content-Type: text/html; charset=utf-8');
  24.         echo file_get_contents(__DIR__.'/../app/Resources/TwigBundle/views/Exception/sync-template-info.html');
  25.         exit();
  26.     }
  27. }
  28. $loader = require_once __DIR__.'/../app/autoload.php';
  29. Debug::enable();
  30. $kernel = new AppKernel('dev'true);
  31. $request Request::createFromGlobals();
  32. if (file_exists(__DIR__.'/../app/config/proxy.php')) {
  33.     $ips = require_once __DIR__.'/../app/config/proxy.php';
  34.     // @see https://symfony.com/doc/3.x/deployment/proxies.html
  35.     Request::setTrustedProxies(
  36.         $ips,
  37.         Request::HEADER_X_FORWARDED_ALL
  38.     );
  39. }
  40. $kernel->setRequest($request);
  41. $response $kernel->handle($request);
  42. $response->send();
  43. $kernel->terminate($request$response);