本文整理汇总了PHP中Map::dispatch方法的典型用法代码示例。如果您正苦于以下问题:PHP Map::dispatch方法的具体用法?PHP Map::dispatch怎么用?PHP Map::dispatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map
的用法示例。
在下文中一共展示了Map::dispatch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public static function process($route, $type)
{
$sammy = static::instance();
// Check for ajax
if ($type == 'XMLHttpRequest') {
$sammy->method = isset($_SERVER['HTTP_X_REQUESTED_WITH']) ? $_SERVER['HTTP_X_REQUESTED_WITH'] : 'GET';
}
if (static::$route_found || (!preg_match('@^' . $route . '(?:\\.(\\w+))?$@uD', $sammy->uri, $matches) || $sammy->method != $type)) {
return false;
}
//Define Parameter
if (isset($matches[1])) {
$params = explode('/', $matches[1]);
} else {
$params = null;
}
static::$route_found = true;
Map::dispatch($params);
}
示例2: process
public static function process($route, $type)
{
$sammy = static::instance();
// Check for ajax
if ($type == 'XMLHttpRequest') {
$sammy->method = isset($_SERVER['HTTP_X_REQUESTED_WITH']) ? $_SERVER['HTTP_X_REQUESTED_WITH'] : 'GET';
}
if (static::$route_found || (!preg_match('@^' . $route . '(?:\\.(\\w+))?$@uD', $sammy->uri, $matches) || $sammy->method != $type)) {
return false;
}
// Get the extension
$extension = $matches[count($matches) - 1];
$extension_test = substr($sammy->uri, -(strlen($extension) + 1), strlen($extension) + 1);
if ($extension_test == '.' . $extension) {
$sammy->format = $extension;
} else {
$sammy->format = 'html';
}
static::$route_found = true;
Map::dispatch($sammy->format);
}
示例3: die
}
if (isset($argv[4])) {
$action = $argv[4];
}
if (isset($argv[5])) {
$params[0] = $argv[5];
}
if (isset($argv[6])) {
$params[1] = $argv[6];
}
$dir = '../textsite/';
$textsiteDir = $dir . $projectName . '/' . $siteDirName . '/';
$configPath = $textsiteDir . 'config/config.php';
if (!file_exists($configPath)) {
die("config file does not exitst");
}
include $configPath;
extract($cfg);
$scArr = explode('#', $statcounter);
$sc_project = $scArr[0];
$sc_security = $scArr[1];
include $textsiteDir . 'config/define-site-config.php';
include $textsiteDir . 'libs/initvars.php';
include $textsiteDir . 'libs/object.php';
include $textsiteDir . 'libs/controller.php';
include $textsiteDir . 'libs/component.php';
include $textsiteDir . 'libs/cache.php';
include $textsiteDir . 'libs/helper.php';
include 'router.php';
Map::dispatch($controller, $action, $params);