本文整理汇总了PHP中RequestHandler::start方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestHandler::start方法的具体用法?PHP RequestHandler::start怎么用?PHP RequestHandler::start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RequestHandler
的用法示例。
在下文中一共展示了RequestHandler::start方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start
static function start ($config_file = null) {
// Default config file, default path: the Frix dir
self::load_config( join_path(array(dirname(__FILE__), 'default_config.php')) );
// Load user config file
// Default config file path: same dir of the root 'index.php' file
self::load_config($config_file ? $config_file : join_path(dirname($_SERVER['SCRIPT_FILENAME']), 'config.php'));
// Import commonly used modules
load('RequestHandler');
load('Router');
load('Fs');
load('App');
load('Db/Db');
load('Field');
load('Db/Model');
load('Db/Query');
load('Template');
// Create a database connection
Db::create(Frix::config('DB_URL'));
// Use PATH_INFO to feed the request handler
$path = $_SERVER['PATH_INFO'];
// Make sure the path ends with a '/'
if ($path[strlen($path)-1] != '/') {
// If not POSTing, fix the path and redirect
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
redir(url(Frix::config('WEB_ROOT'), $path));
}
// Otherwise, just fix the path
$path = url($path);
}
// Create a request handler
$handler = new RequestHandler(Frix::config('ROUTES'), $path);
// Start processing the request
$handler->start();
}