Rev 3 | Rev 5 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
<?phpdeclare(strict_types=1);use Laminas\Mvc\Application;use Laminas\Stdlib\ArrayUtils;//define('DIR_URL', dirname(__DIR__));//define('SITE_URL', 'http://' . $_SERVER['SERVER_NAME'] . '/');//date_default_timezone_set('Etc/GMT+6');header('Access-Control-Allow-Origin: *');header("Access-Control-Allow-Headers: X-API-KEY, Origin, X-Requested-With, Content-Type, Accept, Access-Control-Request-Method");header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");header("Allow: GET, POST, OPTIONS, PUT, DELETE");$method = $_SERVER['REQUEST_METHOD'];if($method == "OPTIONS") {die();}/**if (isset($_SERVER['HTTP_ORIGIN'])) {// should do a check here to match $_SERVER['HTTP_ORIGIN'] to a// whitelist of safe domainsheader("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");header('Access-Control-Allow-Credentials: true');header('Access-Control-Max-Age: 86400'); // cache for 1 day}// Access-Control headers are received during OPTIONS requestsif ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");}*/ini_set('display_errors', '1');ini_set('display_startup_errors', '1');ini_set('log_errors', '1');error_reporting(E_ALL);echo '<pre>';print_r($_SERVER);print_r($_ENV);print_r($_REQUEST);echo '<pre>';exit;/*** This makes our life easier when dealing with paths. Everything is relative* to the application root now.*/chdir(dirname(__DIR__));// Decline static file requests back to the PHP built-in webserverif (php_sapi_name() === 'cli-server') {$path = realpath(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));if (is_string($path) && __FILE__ !== $path && is_file($path)) {return false;}unset($path);}// Composer autoloadinginclude __DIR__ . '/../vendor/autoload.php';if (! class_exists(Application::class)) {throw new RuntimeException("Unable to load application.\n". "- Type `composer install` if you are developing locally.\n". "- Type `vagrant ssh -c 'composer install'` if you are using Vagrant.\n". "- Type `docker-compose run lamians composer install` if you are using Docker.\n");}// Retrieve configuration$appConfig = require __DIR__ . '/../config/application.config.php';if (file_exists(__DIR__ . '/../config/development.config.php')) {$appConfig = ArrayUtils::merge($appConfig, require __DIR__ . '/../config/development.config.php');}// Run the application!Application::init($appConfig)->run();