本文整理汇总了PHP中Debugger::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Debugger::set方法的具体用法?PHP Debugger::set怎么用?PHP Debugger::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debugger
的用法示例。
在下文中一共展示了Debugger::set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: route
//.........这里部分代码省略.........
if (count($parameters)) {
$part = array_shift($parameters);
$matches = glob($root . $dir . $part . '(*).phtml');
if (count($matches) == 0) {
array_unshift($parameters, $part);
$matches = glob($root . $dir . 'index(*).phtml');
}
} else {
$matches = glob($root . $dir . 'index(*).phtml');
}
$csrfOk = static::$method == 'GET' ? true : Session::checkCsrfToken();
if (!$csrfOk) {
$status = 403;
$matches = glob($root . 'error/forbidden(*).phtml');
$dir = '';
$i = count($parts);
}
if (!static::$allowGet && $hasGet) {
$status = 405;
$matches = glob($root . 'error/method_not_allowed(*).phtml');
$dir = '';
$i = count($parts);
}
if (count($matches) == 0) {
$status = 404;
$matches = glob($root . 'error/not_found(*).phtml');
$dir = '';
$i = count($parts);
}
if (count($matches) == 0) {
static::error('Could not find 404');
}
if (count($matches) > 1) {
static::error('Mutiple views matched: ' . implode(', ', $matches));
}
list($view, $template) = static::extractParts($matches[0], $root, $dir);
static::$url = $dir . $view;
static::$view = static::$pageRoot . $dir . $view . '(' . $template . ').phtml';
static::$template = $template != 'none' ? static::$templateRoot . $template : false;
$matches = glob($root . $dir . $view . '().php');
if (count($matches) == 0) {
$matches = glob($root . $dir . $view . '($*).php');
}
if (count($matches) == 0) {
static::$action = false;
}
if (count($matches) > 1) {
static::error('Mutiple actions matched: ' . implode(', ', $matches));
}
static::$parameters = array();
if (count($matches) == 1) {
static::$action = $matches[0];
$parameterNames = static::extractParameterNames($matches[0], $root, $dir, $view);
if (substr(static::$url, -7) == '//index') {
$redirect = substr(static::$url, 0, -7);
}
if (substr(static::$original, -6) == '/index') {
$redirect = substr(static::$url, 0, -6);
}
if (count($parameters) > count($parameterNames)) {
if (substr(static::$url, -6) == '/index') {
static::$url = substr(static::$url, 0, -6);
}
if (count($parameterNames)) {
$redirect = static::$url . '/' . implode('/', array_slice($parameters, 0, count($parameterNames)));
} else {
$redirect = static::$url;
}
}
$parameters = array_map('urldecode', $parameters);
if (count($parameters) < count($parameterNames)) {
for ($i = count($parameters); $i < count($parameterNames); $i++) {
array_push($parameters, null);
}
}
if (!$redirect && count($parameterNames)) {
static::$parameters = array_combine($parameterNames, $parameters);
}
}
break;
}
}
if (Debugger::$enabled) {
$method = static::$method;
$request = '/' . static::$original;
$url = '/' . static::$url;
$viewFile = static::$view;
$actionFile = static::$action;
$templateFile = static::$template;
$parameters = array();
$parameters['url'] = static::$parameters;
$parameters['get'] = $_GET;
$parameters['post'] = $_POST;
Debugger::set('router', compact('method', 'csrfOk', 'request', 'url', 'dir', 'view', 'template', 'viewFile', 'actionFile', 'templateFile', 'parameters'));
Debugger::set('status', $status);
}
if ($redirect) {
static::redirect($redirect);
}
}