start.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * The Front Controller for handling every request
  4. *
  5. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  6. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  7. *
  8. * Licensed under The MIT License
  9. * For full copyright and license information, please see the LICENSE.txt
  10. * Redistributions of files must retain the above copyright notice.
  11. *
  12. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  13. * @link https://cakephp.org CakePHP(tm) Project
  14. * @since 0.2.9
  15. * @license MIT License (https://opensource.org/licenses/mit-license.php)
  16. */
  17. //require __DIR__ . '/vendor/autoload.php';
  18. use App\Application;
  19. use Cake\Http\Server;
  20. global $server;
  21. // Bind your application to the server.
  22. $server = new Server(new Application(__DIR__ . '/config'));
  23. function run(): string
  24. {
  25. global $server;
  26. ob_start();
  27. // Run the request/response through the application and emit the response.
  28. $server->emit($server->run());
  29. header(HeaderDate::$date); // To pass the bench, nginx auto add it
  30. return ob_get_clean();
  31. }