当前位置: 首页>>代码示例>>PHP>>正文


PHP WebRequest::pathInfo方法代码示例

本文整理汇总了PHP中WebRequest::pathInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP WebRequest::pathInfo方法的具体用法?PHP WebRequest::pathInfo怎么用?PHP WebRequest::pathInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebRequest的用法示例。


在下文中一共展示了WebRequest::pathInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 public static function create()
 {
     // use "Main" as the default
     $page = "Main";
     // check the requested page title for safety and sanity
     $pathinfo = explode('/', WebRequest::pathInfo());
     $pathinfo = array_values(array_filter($pathinfo));
     if (count($pathinfo) >= 1 && $pathinfo[0] != "" && !ereg("[^a-zA-Z0-9]", $pathinfo[0])) {
         $page = $pathinfo[0];
     }
     // okay, the page title should be reasonably safe now, let's try and make the page
     $pagename = "Page" . $page;
     global $cIncludePath;
     $filepath = $cIncludePath . "/Page/" . $pagename . ".php";
     if (file_exists($filepath)) {
         require_once $filepath;
     } else {
         // oops, couldn't find the requested page, let's fail gracefully.
         $pagename = "Page404";
         $filepath = $cIncludePath . "/Page/" . $pagename . ".php";
         require_once $filepath;
     }
     if (class_exists($pagename)) {
         $pageobject = new $pagename();
         if (get_parent_class($pageobject) == "PageBase") {
             Hooks::run("CreatePage", array($pageobject));
             return $pageobject;
         } else {
             // defined, but doesn't inherit properly, so we can't guarentee stuff will work.
             throw new Exception();
         }
     } else {
         // file exists, but the class "within" doesn't, this is a problem as stuff isn't where it should be.
         throw new Exception();
     }
 }
开发者ID:vulnerabilityCode,项目名称:hotel-system,代码行数:36,代码来源:PageBase.php


注:本文中的WebRequest::pathInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。