本文整理汇总了PHP中PageManager::getControllerPathByUrlPath方法的典型用法代码示例。如果您正苦于以下问题:PHP PageManager::getControllerPathByUrlPath方法的具体用法?PHP PageManager::getControllerPathByUrlPath怎么用?PHP PageManager::getControllerPathByUrlPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PageManager
的用法示例。
在下文中一共展示了PageManager::getControllerPathByUrlPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
foreach (glob('controllers/*.*') as $filename) {
#get controller name
preg_match('~\\/(.*?)\\.~', $filename, $output);
$filename = '/' . $filename;
#create controller array
$aControllers[$output[1]] = $filename;
}
# Check if the controller exist in the controller aray (see above)
if (array_key_exists($sControllerRequest, $aControllers)) {
$sControllerPath = $aControllers[$sControllerRequest];
} else {
/*
* Check if class could exists
* Then search for a matching page in the Database
* if a pageControllerPath is found, take this one for displaying
*/
if (classCouldBeLoaded('PageManager')) {
$sControllerPath = PageManager::getControllerPathByUrlPath(getCurrentUrlPath());
}
# Path found? GO
if (empty($sControllerPath) && !empty($sControllerRequest)) {
# non existing controller request and page
showHttpError(404);
}
}
# Check if the file excist
if (file_exists(DOCUMENT_ROOT . $sControllerPath)) {
include_once DOCUMENT_ROOT . $sControllerPath;
} else {
showHttpError(404);
}