本文整理匯總了PHP中Dispatcher::main方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dispatcher::main方法的具體用法?PHP Dispatcher::main怎麽用?PHP Dispatcher::main使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Dispatcher
的用法示例。
在下文中一共展示了Dispatcher::main方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: main
<?php
Dispatcher::main();
class Dispatcher
{
private static $controller;
public static function main()
{
$time_start = microtime(true);
require_once 'lib/functions.php';
session_start();
header('Content-Type: text/html; charset=UTF-8');
if (!function_exists('apache_request_headers')) {
exit('Apache server is required. (PHP function "apache_request_headers" not found)');
}
$request_headers = apache_request_headers();
//get headers for AJAX detection
define('BASEDIR', dirname(__FILE__));
define('IS_AJAX', (empty($request_headers['X-Requested-With']) or $request_headers['X-Requested-With'] != 'XMLHttpRequest') ? false : true);
self::$controller = new Controller();
self::$controller->View = new View(self::$controller);
$action = 'index';
if (!empty($_GET['url'])) {
$params = explode("/", $_GET['url']);
$action = preg_replace('/[^a-zA-Z0-9]/', '', $params[0]);
if (substr($action, 0, 1) == '_') {
exit("Failure to load pseudo-protected controller action {$action}");
}
if (!method_exists('Controller', $action)) {
exit("Failure to load Controller action <b>{$action}</b>");
}
示例2: Dispatcher
function test_PagedDisplay()
{
$PAGE_SIZE = 3;
bibtexbrowser_configure('BIBTEXBROWSER_DEFAULT_DISPLAY', 'PagedDisplay');
bibtexbrowser_configure('PAGE_SIZE', $PAGE_SIZE);
$_GET['bib'] = 'bibacid-utf8.bib';
$_GET['all'] = 1;
$d = new Dispatcher();
ob_start();
$d->main();
$content = "<div>" . ob_get_flush() . "</div>";
$xml = new SimpleXMLElement($content);
$result = $xml->xpath('//td[@class=\'bibref\']');
$this->assertEquals($PAGE_SIZE, count($result));
}