CodeIgniter4/public/index.php

54 lines
1.7 KiB
PHP
Raw Normal View History

<?php
// Path to the front controller (this file)
2018-10-29 23:25:57 -05:00
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR);
2016-06-23 00:29:44 -05:00
/*
*---------------------------------------------------------------
* BOOTSTRAP THE APPLICATION
2016-06-23 00:29:44 -05:00
*---------------------------------------------------------------
* This process sets up the path constants, loads and registers
* our autoloader, along with Composer's, loads our constants
* and fires up an environment-specific bootstrapping.
*/
// Ensure the current directory is pointing to the front controller's directory
chdir(FCPATH);
// This is the line that might need to be changed, depending on your folder structure.
$pathsConfig = FCPATH . '../app/Config/Paths.php';
// ^^^ Change this line if you move your application folder
// Load our paths config file
require $pathsConfig;
$paths = new Config\Paths();
2018-05-29 13:52:38 -07:00
// Location of the framework bootstrap file.
2020-08-26 01:22:28 +08:00
$bootstrap = rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php';
require $bootstrap;
/*
* ---------------------------------------------------------------
* GRAB OUR CODEIGNITER INSTANCE
* ---------------------------------------------------------------
*
* The CodeIgniter class contains the core functionality to make
* the application run, and does all of the dirty work to get
* the pieces all working together.
*/
$app = Config\Services::codeigniter();
$app->initialize();
$context = is_cli() ? 'php-cli' : 'web';
$app->setContext($context);
/*
*---------------------------------------------------------------
* LAUNCH THE APPLICATION
*---------------------------------------------------------------
* Now that everything is setup, it's time to actually fire
* up the engines and make this app do its thang.
*/
$app->run();