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


PHP Uri::loadFile方法代码示例

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


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

示例1: __construct

 /**
  * Routing controllers.
  *
  * @access private
  */
 private function __construct()
 {
     /** Objects are created for the functioning of the class. * */
     $this->oConfig = Config::getInstance();
     $this->oRegistry = Registry::getInstance();
     $this->oHttpRequest = new Http();
     $this->oUri = Uri::getInstance();
     $this->indexFileRouter();
     if ($this->oUri->fragment(0) === 'asset' && $this->oUri->fragment(1) === 'gzip') {
         // Loading and compress CSS and JavaScript files
         $this->gzipRouter();
         exit;
     }
     /**
      * @internal We initialize the database after compression of static files (\PH7\Framework\Mvc\Router\FrontController::gzipRouter() method),
      * so we can always display static files even if there are problems with the database.
      */
     $this->_databaseInitialize();
     /**
      * @internal This method must be declared before the rest of the code, because it initializes essential language constants for the rest of the code.
      */
     $this->_languageInitialize();
     // For the resources of the assets folders
     if ($this->oUri->fragment(0) === 'asset') {
         switch ($this->oUri->fragment(1)) {
             case 'ajax':
                 // Loading Asynchronous Ajax files
                 $this->ajaxRouter();
                 break;
             case 'file':
                 // Loading files
                 $this->fileRouter();
                 break;
             case 'cron':
                 // Loading Cron Jobs files
                 $this->cronRouter();
                 break;
             case 'css':
                 // Loading Style sheet files
                 $this->cssRouter();
                 break;
             case 'js':
                 // Loading JavaScript files
                 $this->jsRouter();
                 break;
             default:
                 $this->notFound('Not found Asset file!', 1);
         }
         exit;
     }
     $oUrl = UriRoute::loadFile(new \DomDocument());
     foreach ($oUrl->getElementsByTagName('route') as $oRoute) {
         if (preg_match('`^' . $oRoute->getAttribute('url') . '/?(?:\\?[^/]+\\=[^/]+)?$`', $this->oHttpRequest->requestUri(), $aMatches)) {
             $this->bRouterRewriting = true;
             $sPathModule = $oRoute->getAttribute('path') . PH7_SH;
             // Get module
             $this->oRegistry->module = $oRoute->getAttribute('module');
             // Check if file exist
             if (!$this->oConfig->load(PH7_PATH_APP . $sPathModule . $this->oRegistry->module . PH7_DS . PH7_CONFIG . PH7_CONFIG_FILE)) {
                 $this->notFound('The <b>' . $this->oRegistry->module . '</b> system module is not found.<br />File: <b>' . PH7_PATH_APP . $sPathModule . $this->oRegistry->module . PH7_DS . '</b><br /> or the <b>' . PH7_CONFIG_FILE . '</b> file is not found.<br />File: <b>' . PH7_PATH_APP . $sPathModule . $this->oRegistry->module . PH7_DS . PH7_CONFIG . PH7_CONFIG_FILE . '</b>');
                 // It reloads the config.ini file for the new module "error"
                 $this->oConfig->load(PH7_PATH_MOD . $this->oRegistry->module . PH7_DS . PH7_CONFIG . PH7_CONFIG_FILE);
             }
             /***** PATH THE MODULE *****/
             $this->oRegistry->path_module = PH7_PATH_APP . $sPathModule . $this->oRegistry->module . PH7_DS;
             /***** URL THE MODULE *****/
             $this->oRegistry->url_module = PH7_URL_ROOT . $this->oRegistry->module . PH7_SH;
             /***** PATH THE TEMPLATE *****/
             $this->oRegistry->path_themes_module = PH7_PATH_ROOT . PH7_LAYOUT . $sPathModule . $this->oRegistry->module . PH7_DS . PH7_TPL;
             /***** URL THE TEMPLATE *****/
             $this->oRegistry->url_themes_module = PH7_RELATIVE . PH7_LAYOUT . $sPathModule . $this->oRegistry->module . PH7_SH . PH7_TPL;
             // Get the default controller
             $this->oRegistry->controller = ucfirst($oRoute->getAttribute('controller')) . 'Controller';
             // Get the default action
             $this->oRegistry->action = $oRoute->getAttribute('action');
             if ($oRoute->hasAttribute('vars')) {
                 $aVars = explode(',', $oRoute->getAttribute('vars'));
                 $iOffset = count($aVars);
                 foreach ($aMatches as $sKey => $sMatch) {
                     if ($sKey !== 0) {
                         $this->oHttpRequest->setGet($aVars[$sKey - 1], $sMatch);
                         /** Request Parameter for the Router Rewriting mode. * */
                         $this->aRequestParameter = $this->oUri->segments($this->oUri->totalFragment() - $iOffset);
                     }
                 }
             }
             break;
         }
     }
     unset($oUrl);
     if (empty($this->bRouterRewriting)) {
         if ($this->oUri->fragment(0) === 'm') {
             $this->simpleModuleRouter();
         } else {
             $this->simpleRouter();
//.........这里部分代码省略.........
开发者ID:revcozmo,项目名称:pH7-Social-Dating-CMS,代码行数:101,代码来源:FrontController.class.php


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