예제 #1
0
$registry->set('weight', new Weight($registry));
// Length
$registry->set('length', new Length($registry));
// Cart
$registry->set('cart', new Cart($registry));
// Front Controller
$controller = new Front($registry);
// Rewrite
$rewrite = new Rewrite($registry);
$url->addRewrite($rewrite);
// Runtimer
$timer = new Runtime($registry);
$timer->start();
// Maintenance Mode
$controller->addPreAction(new Action('common/maintenance'));
// SEO URL's
$controller->addPreAction(new Action('common/seo_url'));
// RESTFUL URL's
//$controller->addPreAction(new Action('common/reset'));
// Router
if (isset($request->get['route'])) {
    $action = new Action($request->get['route']);
} else {
    $action = new Action('common/home');
}
// Dispatch
$controller->dispatch($action, new Action('error/not_found'));
$timer->stop();
$log->log_time($timer->spent());
// Output
$response->output();
예제 #2
0
<?php

/**
 * Created by: Hiko
 * Date: 14-10-13
 * Time: 上午10:06
 */
require_once 'Runtime.php';
require_once 'IpService.php';
$findIp = '61.135.169.74';
// 测试的ip
$runtime = new Runtime();
$runtime->start();
$info = IpService::getIpInfo($findIp);
$runtime->end();
var_dump($info);
echo '查询IP: ' . $findIp . ' 耗时 <span style="color: green;">' . $runtime->spent() . '</span> 毫秒';