#2 | Phalcon\Mvc\Application->handle()
/var/www/coodinweixin/workweixin/public/index.php (86) <?php
error_reporting(E_ALL);
(new \Phalcon\Debug())->listen();//开启调试监听
define('BASE_PATH', dirname(__DIR__));
define('APP_PATH', BASE_PATH . '/app');
use Phalcon\Loader;
use Phalcon\Mvc\Router;
use Phalcon\DI\FactoryDefault;
use Phalcon\Mvc\Application as BaseApplication;
use Phalcon\Mvc\Url as UrlResolver;
use Phalcon\Session\Adapter\Files as SessionAdapter;
use Phalcon\Mvc\Model\Metadata\Memory as MetaDataAdapter;
class Application extends BaseApplication
{
/**
* Register the services here to make them general or register in the ModuleDefinition to make them module-specific
*/
protected function registerServices()
{
$di = new FactoryDefault();
$di->setShared('config', function () {
return include APP_PATH . "/config/config.php";
});
$di->setShared('url', function () {
$config = $this->getConfig();
$url = new UrlResolver();
$url->setBaseUri($config->application->baseUri);
return $url;
});
$di->setShared('session', function () {
$session = new SessionAdapter();
$session->start();
return $session;
});
/**
* If the configuration specify the use of metadata adapter use it or use memory otherwise
*/
$di->setShared('modelsMetadata', function () {
return new MetaDataAdapter();
});
include APP_PATH . '/config/router.php';
/**
* Include Autoloader
*/
$config = $di->getConfig();
include APP_PATH . '/config/loader.php';
// Registering a router
$di->set('router', function () {
return include APP_PATH . "/config/router.php";
});
$this->setDI($di);
}
public function main()
{
$this->registerServices();
// Register the installed modules
$this->registerModules([
'isv' => [
'className' => 'Modules\Isv\Module',
'path' => APP_PATH.'/modules/isv/Module.php'
],
'backend' => [
'className' => 'Modules\Backend\Module',
'path' => APP_PATH.'/modules/backend/Module.php'
]
]);
echo $this->handle()->getContent();
}
}
$application = new Application();
$application->main();
|
#3 | Application->main()
/var/www/coodinweixin/workweixin/public/index.php (91) <?php
error_reporting(E_ALL);
(new \Phalcon\Debug())->listen();//开启调试监听
define('BASE_PATH', dirname(__DIR__));
define('APP_PATH', BASE_PATH . '/app');
use Phalcon\Loader;
use Phalcon\Mvc\Router;
use Phalcon\DI\FactoryDefault;
use Phalcon\Mvc\Application as BaseApplication;
use Phalcon\Mvc\Url as UrlResolver;
use Phalcon\Session\Adapter\Files as SessionAdapter;
use Phalcon\Mvc\Model\Metadata\Memory as MetaDataAdapter;
class Application extends BaseApplication
{
/**
* Register the services here to make them general or register in the ModuleDefinition to make them module-specific
*/
protected function registerServices()
{
$di = new FactoryDefault();
$di->setShared('config', function () {
return include APP_PATH . "/config/config.php";
});
$di->setShared('url', function () {
$config = $this->getConfig();
$url = new UrlResolver();
$url->setBaseUri($config->application->baseUri);
return $url;
});
$di->setShared('session', function () {
$session = new SessionAdapter();
$session->start();
return $session;
});
/**
* If the configuration specify the use of metadata adapter use it or use memory otherwise
*/
$di->setShared('modelsMetadata', function () {
return new MetaDataAdapter();
});
include APP_PATH . '/config/router.php';
/**
* Include Autoloader
*/
$config = $di->getConfig();
include APP_PATH . '/config/loader.php';
// Registering a router
$di->set('router', function () {
return include APP_PATH . "/config/router.php";
});
$this->setDI($di);
}
public function main()
{
$this->registerServices();
// Register the installed modules
$this->registerModules([
'isv' => [
'className' => 'Modules\Isv\Module',
'path' => APP_PATH.'/modules/isv/Module.php'
],
'backend' => [
'className' => 'Modules\Backend\Module',
'path' => APP_PATH.'/modules/backend/Module.php'
]
]);
echo $this->handle()->getContent();
}
}
$application = new Application();
$application->main();
|