/** * ディスパッチャーを起動します * @param \radium\action\Request $request */ public static function run(Request $request) { $dispatcher = new Dispatcher($request); list($controllerObj, $data) = $dispatcher->dispatch(); $contentType = ''; $output = ''; if (is_string($data) || is_numeric($data) || is_bool($data)) { $output = $data; $contentType = 'text/plain'; } else { $controllerObj->invokeMethod('_finalize', $data ? array($data) : array()); $output = $controllerObj->renderedContent(); $contentType = $controllerObj->view->contentType(); } header('Content-Type: ' . $contentType . '; charset=UTF-8'); echo $output; }
<?php /** * radium: the most RAD PHP Framework * * @copyright Copyright 2012, Playwell Inc. * @license http://opensource.org/licenses/bsd-license.php The BSD License */ // ブートストラップ require dirname(__DIR__) . '/conf/bootstrap.php'; // ディスパッチャーを起動 echo \radium\action\Dispatcher::run(new \radium\net\http\Request());