<?php /** * Created by PhpStorm. * User: hehanlin * Date: 2015/8/1 * Time: 10:41 */ define('BASEDIR', __DIR__); require_once BASEDIR . '/System/Loader.php'; spl_autoload_register('\\System\\Loader::autoload'); System\Application::getInstance(BASEDIR)->dispatch();
// define some constant that will be useful. all the path constant must have no trailing slash. if (!defined('DS')) { define('DS', DIRECTORY_SEPARATOR); } if (!defined('ROOT_PATH')) { define('ROOT_PATH', __DIR__); } if (!defined('MODULE_PATH')) { define('MODULE_PATH', ROOT_PATH . DS . 'modules'); } if (!defined('CMS_PATH')) { define('CMS_PATH', MODULE_PATH . DS . 'Cms'); } if (!defined('SYSTEM_PATH')) { define('SYSTEM_PATH', ROOT_PATH . DS . 'system'); } if (!defined('STORAGE_PATH')) { define('STORAGE_PATH', ROOT_PATH . DS . 'storage'); } if (!defined('APP_ENV')) { // define app environment. value can be development, test, production. define('APP_ENV', 'development'); } // require composer autoload. require_once SYSTEM_PATH . DS . 'vendor' . DS . 'autoload.php'; // global variables. this is very useful when you want to access it across the object. global $Profiler; // start the system application. $sysapp = new System\Application(); $sysapp->run(); unset($Profiler, $sysapp);
<?php $app = new System\Application(); // if the framework files and folders are within a folder in your local server, in my case, mvc. // you have to set the base path. $app->getInstance('router')->setBasePath('mvc/public/'); require_once BASE_PATH . 'app/routes.php'; $app->run();
<?php ini_set("display_errors", 1); error_reporting(E_ALL & ~(E_STRICT | E_NOTICE)); define("MVC_FRIENDLY_URL", true); require_once '../../PHPMVCFramework/System/Application.php'; $app = new \System\Application(); $app->Start();