Example #1
0
                            $params[$key] = $p->getDefaultValue();
                        } else {
                            throw new PMPException(sprintf('Not Found Controller Paramater %s In %s', get_class($controller) . ':' . $method, $p->getName()));
                        }
                    }
                }
                call_user_func_array(array($controller, $method), $params);
            } else {
                $controller->{$method}();
            }
            $benchmark->setMark("action");
            $benchmark->stop();
            //$benchmark->display(false);
        } catch (\Exception $e) {
            throw new PMPException($e);
        }
    }
}
$rootdir = dirname(__FILE__) . '/../../../../../..';
$hostname = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '';
if (isset($_SERVER['SERVER_PORT']) && !in_array($_SERVER['SERVER_PORT'], array(80, 443))) {
    $hostname .= ':' . $_SERVER['SERVER_PORT'];
}
$documentroot = preg_replace('/^' . preg_quote($_SERVER['DOCUMENT_ROOT'], '/') . '/', '', realpath($rootdir));
Application::setRootDir($rootdir);
Application::setBaseUrl($documentroot);
Application::setWebDir('/web');
Application::setWebUrl($documentroot . '/web');
Application::setHostname(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '');
Application::setHostname(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '');