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


PHP URI::getURI方法代码示例

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


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

示例1: renderContent

 public function renderContent($template = 'content', $return = false)
 {
     switch (URI::getURI()) {
         case '':
             $template = 'content';
             break;
         case 'messages':
             $template = 'messages';
             break;
         case 'friends':
             $template = 'friends';
             break;
         case 'groups':
             $template = 'groups';
             break;
         case 'settings':
             $template = 'settings';
             break;
         case '?logout':
             $template = 'register';
             break;
         default:
             $template = 'page404';
     }
     if ($return) {
         return $this->render($template, true);
     } else {
         echo $this->render($template, true);
     }
 }
开发者ID:TarikW,项目名称:easyEngine,代码行数:30,代码来源:main_class.php

示例2: run

 /**
  * Run Routing
  */
 public static function run()
 {
     $route = null;
     if (file_exists(APP_PATH . 'Config/route.php')) {
         $route = (require APP_PATH . 'Config/route.php');
     } elseif (APP_ENV === 'development') {
         error_dump('File \'' . APP_PATH . 'Config/route.php\' not found');
         die;
     }
     self::$rootController = '';
     $uri = URI::getURI();
     $arrUri = explode('/', $uri);
     if ($route == null) {
         if (APP_ENV === 'development') {
             error_dump('Route config is not set correctly!');
             die;
         }
     }
     self::$page404 = self::getPage404Config($route);
     self::$methodSeparator = self::getMethodSeparator($route);
     self::loadRootController($route);
     self::getClassAndMethod($route, $uri);
     if (!self::$routeFound) {
         self::$className = (isset($arrUri[0]) ? $arrUri[0] : '') . 'Controller';
         self::$methodName = isset($arrUri[1]) ? $arrUri[1] : 'index';
     }
     if (self::$className != '' && self::$methodName != '' && strtolower(self::$className) != strtolower(self::$rootController)) {
         $_modulePath = trim('Modules/' . ucfirst(trim(strtolower(str_replace('Controller', '', self::$className)))), '/') . '/';
         self::$className = ucfirst(self::$className);
         if (file_exists(APP_PATH . 'Controllers/' . self::$className . '.php')) {
             self::callClassMethod();
         } elseif (file_exists(APP_PATH . $_modulePath . 'Controllers/' . self::$className . '.php')) {
             $GLOBALS['modulePath'] = $_modulePath;
             self::callClassMethod();
         } elseif (file_exists(APP_PATH . 'views/404.blade.php')) {
             $class = new self::$page404();
             $class->index();
         } else {
             error_dump('404 Page Not Found!');
             die;
         }
     }
 }
开发者ID:jokopurnomoa,项目名称:elips-php,代码行数:46,代码来源:Route.php

示例3: segment

 /**
  * Get URI Segment
  *
  * @param $segment
  * @return string
  */
 public static function segment($segment)
 {
     $segment = $segment > 0 ? $segment : 1;
     $uri = explode('/', URI::getURI());
     return isset($uri[$segment - 1]) ? $uri[$segment - 1] : '';
 }
开发者ID:jokopurnomoa,项目名称:elips-php,代码行数:12,代码来源:URI.php

示例4: run

 /**
  * Run Core
  */
 public function run()
 {
     /**
      * Require main helper
      */
     require FW_PATH . 'Helpers/file.php';
     require FW_PATH . 'Helpers/log.php';
     require FW_PATH . 'Helpers/input.php';
     require FW_PATH . 'Helpers/error.php';
     require FW_PATH . 'Helpers/url.php';
     require FW_PATH . 'Helpers/config.php';
     /**
      * Check assets request
      */
     if (self::isAssetsRequest(URI::getURI())) {
         exit;
     }
     /**
      * Require app config
      */
     if (file_exists(APP_PATH . 'Config/app.php')) {
         $config = (require APP_PATH . 'Config/app.php');
         if (is_array($config) && $config !== null) {
             foreach ($config as $key => $value) {
                 $GLOBALS['config'][$key] = $value;
             }
         }
     } elseif (APP_ENV === 'development') {
         error_dump('File \'' . APP_PATH . 'Config/app.php\' not found!');
         die;
     }
     /**
      * Require database config
      */
     if (file_exists(APP_PATH . 'Config/database.php')) {
         $config = (require APP_PATH . 'Config/database.php');
         if (is_array($config) && $config !== null) {
             foreach ($config as $key => $value) {
                 $GLOBALS['config'][$key] = $value;
             }
         }
     } elseif (APP_ENV === 'development') {
         error_dump('File \'' . APP_PATH . 'Config/database.php\' not found!');
         die;
     }
     /**
      * Require mimes config
      */
     if (file_exists(APP_PATH . 'Config/mimes.php')) {
         $config = (require APP_PATH . 'Config/mimes.php');
         if (is_array($config) && $config !== null) {
             foreach ($config as $key => $value) {
                 $GLOBALS['config'][$key] = $value;
             }
         }
     } elseif (APP_ENV === 'development') {
         error_dump('File \'' . APP_PATH . 'Config/mimes.php\' not found!');
         die;
     }
     $this->handleAutoload();
     Route::run();
 }
开发者ID:jokopurnomoa,项目名称:elips-php,代码行数:65,代码来源:Core.php


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