本文整理汇总了PHP中PageRenderer::setContent方法的典型用法代码示例。如果您正苦于以下问题:PHP PageRenderer::setContent方法的具体用法?PHP PageRenderer::setContent怎么用?PHP PageRenderer::setContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageRenderer
的用法示例。
在下文中一共展示了PageRenderer::setContent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: substr
// remove trailing and ending slashes
if ($requestUri[0] == '/') {
$requestUri = substr($requestUri, 1);
}
if (substr($requestUri, -1) == '/') {
$requestUri = substr($requestUri, 0, -1);
}
// define default action and controller
$controllerAndAction = $configuration['routes']['_default'];
$pathSegments = array();
// check for action requested via URL
if (strlen($requestUri) && $requestUri != 'index.php') {
$pathSegments = explode('/', $requestUri);
$controllerAndAction = resolvePathsegmentConfiguration($pathSegments);
}
// only proceed if action exists, else throw a 404
try {
require_once 'includes/Controller/' . $controllerAndAction['controller'] . '.php';
$controller = new $controllerAndAction['controller']();
$controller->setArguments($pathSegments);
$methodName = $controllerAndAction['action'] . 'Action';
$content = $controller->{$methodName}();
$content .= getDisclaimer();
} catch (Exception $e) {
header('HTTP/1.0 404 Not Found');
$content = renderFlashMessage('Page not found', 'We\'re sorry, but the desired page could not be found.', 'error');
}
// render and exit
$page->setContent($content);
echo $page->render();
shutdown();