本文整理汇总了PHP中ErrorHandler::message方法的典型用法代码示例。如果您正苦于以下问题:PHP ErrorHandler::message方法的具体用法?PHP ErrorHandler::message怎么用?PHP ErrorHandler::message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorHandler
的用法示例。
在下文中一共展示了ErrorHandler::message方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dispatch
public static function dispatch($routes)
{
$output = '';
// Find a matching route
if ($route = self::findRoute($routes)) {
self::$route = $route;
//format the file name of the controller - camel case, append Controlller
$name = ucfirst($route['controller']) . 'Controller';
$file = CONTROLLERS . $name . '.php';
if (file_exists($file) && (require_once $file)) {
//action
$action = DEFAULT_ACTION;
if (isset($route['action'])) {
$action = $route['action'];
}
$action = ucfirst($action);
$controller = new $name($route);
//could force index to always exist by using an interface or abstract class
//however, this needs to be here to catch human error in a route
if (method_exists($controller, $action)) {
$controller->{$action}();
$output .= $controller->render();
if (function_exists('plugin__pre_render')) {
$output = plugin__pre_render($output);
}
print $output;
if (function_exists('plugin__post_render')) {
plugin__post_render($output);
}
//stop matching
return;
} else {
//action doesn't exist
//self::$error->code = 404;
ErrorHandler::message($action . ' action doesn\'t exist in ' . $name);
}
} else {
//self::$error->code = 404;
ErrorHandler::message($name . ' controller doesn\'t exist');
}
} else {
//self::$error->code = 404;
//ErrorHandler::message('Router did not match any controllers');
ErrorHandler::message('No valid route found!');
}
}
示例2: render
/**
* Combines layout and view(s) and prints final output
*
* @return string
* @author Charles Mastin
* @author Joshua Rudd
**/
public function render()
{
$r = null;
// Create variables for layout from layout_data array
if ($this->layout_data) {
foreach ($this->layout_data as $dataKey => $dataValue) {
${$dataKey} = $dataValue;
}
}
// Create content variables from container output array
$content = array();
if ($this->output) {
foreach ($this->output as $dataKey => $dataValue) {
$content[$dataKey] = $dataValue;
}
}
// Capture output of layout/view and then print it
ob_start();
// If no layout is set, just spit out the view(s)
if (!$this->layout_view) {
if (isset($content['main'])) {
$r .= $content['main'];
}
} elseif ($this->layout_view && @(include $this->layout_file)) {
$r .= ob_get_contents();
} else {
//ErrorHandler::code = 404;
ErrorHandler::message('The ' . $this->layout_view . '.tpl layout could not be found!');
}
ob_end_clean();
return $r;
}