| #1 | Phalcon\Mvc\Application->handle()
<?php
//phpinfo();
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
ini_set('display_errors', '1');
date_default_timezone_set('Etc/GMT-3');
mb_internal_encoding('UTF-8');
function vvtr($data)
{
echo '<pre>';
print_r($data);
echo '</pre>';
}
function vvd($data)
{
echo '<pre>';
print_r($data);
die('</pre>');
}
function v_dump()
{
echo '<pre>';
$params = func_get_args();
if (!empty($params)) {
foreach ($params as $param)
var_dump($param);
} else {
echo 'args is empty';
}
die('</pre>');
}
(new Phalcon\Debug())->listen();
$start = microtime(true);
/**
* The FactoryDefault Dependency Injector automatically register the right services providing a full stack framework
*/
$di = new \Phalcon\DI\FactoryDefault();
/**
* Registering a router
*/
$di->set('router', function () {
return include '../app/router.php';
}, true);
/**
* Start the session the first time some component request the auth service
*/
$di->set('session', function () {
$session = new \Phalcon\Session\Adapter\Files();
$session->start();
//vvd($_SESSION);
//unset($_SESSION['cart']);
return $session;
}, true);
/**
* Handle the request
*/
$application = new \Phalcon\Mvc\Application();
$application->setDI($di);
/**
* Register application modules
*/
$application->registerModules(array(
'frontend' => array(
'className' => 'Modules\Frontend\Module',
'path' => '../app/frontend/Module.php'
),
'backend' => array(
'className' => 'Modules\Backend\Backend',
'path' => '../app/backend/Module.php'
)
));
echo $application->handle()->getContent();
function convert($size)
{
$unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb');
return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $unit[$i];
}
//echo convert(memory_get_usage(true)); // 123 kb
//$time = microtime(true) - $start; printf('Скрипт выполнялся %.4F сек.', $time);
|