本文整理匯總了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();