當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Module::createController方法代碼示例

本文整理匯總了PHP中yii\base\Module::createController方法的典型用法代碼示例。如果您正苦於以下問題:PHP Module::createController方法的具體用法?PHP Module::createController怎麽用?PHP Module::createController使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在yii\base\Module的用法示例。


在下文中一共展示了Module::createController方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: createController

 public function createController($route)
 {
     if ($this->beforeCreateController !== null && !call_user_func($this->beforeCreateController, $route)) {
         return false;
     }
     return parent::createController($route);
 }
開發者ID:MikleUA,項目名稱:yii2-rbac-plus,代碼行數:7,代碼來源:Module.php

示例2: createController

 /**
  * Override createController()
  * @link https://github.com/yiisoft/yii2/issues/810
  * @link http://www.yiiframework.com/forum/index.php/topic/21884-module-and-url-management/
  *
  * @param string $route
  *
  * @return array|bool
  */
 public function createController($route)
 {
     preg_match('/(default)/', $route, $match);
     if (isset($match[0])) {
         return parent::createController($route);
     }
     return parent::createController("{$this->defaultRoute}/{$route}");
 }
開發者ID:ninazu,項目名稱:yii2-mysql-migration,代碼行數:17,代碼來源:Module.php

示例3: createController

 public function createController($route)
 {
     if (strpos($route, 'admin/') !== false) {
         return $this->getModule('admin')->createController(str_replace('admin/', '', $route));
     } else {
         return parent::createController($route);
     }
 }
開發者ID:mirocow,項目名稱:yii2-eav,代碼行數:8,代碼來源:Module.php

示例4: createController

 /**
  * Override createController()
  *
  * @link https://github.com/yiisoft/yii2/issues/810
  * @link http://www.yiiframework.com/forum/index.php/topic/21884-module-and-url-management/
  */
 public function createController($route)
 {
     preg_match('/(default)/', $route, $match);
     if (isset($match[0])) {
         return parent::createController($route);
     }
     $this->defaultRoute = !$this->defaultRoute || $this->defaultRoute == 'default' ? 'url' : $this->defaultRoute;
     if (sizeof(explode('/', $route)) > 1) {
         list($this->defaultRoute, $route) = explode('/', $route);
     }
     return parent::createController("{$this->defaultRoute}/{$route}");
 }
開發者ID:c006,項目名稱:yii2-alias-url,代碼行數:18,代碼來源:Module.php

示例5: createController

 public function createController($route)
 {
     // check valid routes
     $validRoutes = [$this->defaultRoute, "admin", "album", "json"];
     $isValidRoute = false;
     foreach ($validRoutes as $validRoute) {
         if (strpos($route, $validRoute) === 0) {
             $isValidRoute = true;
             break;
         }
     }
     return (empty($route) or $isValidRoute) ? parent::createController($route) : parent::createController("{$this->defaultRoute}/{$route}");
 }
開發者ID:karczmarczyk,項目名稱:photo-archive,代碼行數:13,代碼來源:Module.php

示例6: createController

 public function createController($route)
 {
     $this->normalizeController();
     return parent::createController($route);
 }
開發者ID:hscstudio,項目名稱:yii2-heart,代碼行數:5,代碼來源:Module.php

示例7: createController

 /**
  * Modify createController() to handle routes in the default controller
  *
  * This is a temporary hack until they add in url management via modules
  * @link https://github.com/yiisoft/yii2/issues/810
  * @link http://www.yiiframework.com/forum/index.php/topic/21884-module-and-url-management/
  *
  * "usr" and "usr/default" work like normal
  * "usr/xxx" gets changed to "usr/default/xxx"
  *
  * @inheritdoc
  */
 public function createController($route)
 {
     if (\Yii::$app instanceof \yii\console\Application) {
         return parent::createController($route);
     }
     // check valid routes
     $validRoutes = [$this->defaultRoute, 'auth', 'manager'];
     $isValidRoute = false;
     foreach ($validRoutes as $validRoute) {
         if (strpos($route, $validRoute) === 0) {
             $isValidRoute = true;
             break;
         }
     }
     if (!empty($route) && !$isValidRoute) {
         $route = $this->defaultRoute . '/' . $route;
     }
     return parent::createController($route);
 }
開發者ID:rumatakira,項目名稱:yii2-usr,代碼行數:31,代碼來源:Module.php

示例8: createController

 public function createController($route)
 {
     return parent::createController($this->realRoute ? $this->realRoute : $route);
 }
開發者ID:keyeMyria,項目名稱:YetCMS,代碼行數:4,代碼來源:Module.php

示例9: createController

 public function createController($route)
 {
     return $this->beforeCreateController($route) ? parent::createController($route) : false;
 }
開發者ID:yinheark,項目名稱:yincart2,代碼行數:4,代碼來源:Module.php

示例10: createController

 /**
  * Modify createController() to handle routes in the default controller
  *
  * This is a temporary hack until they add in url management via modules
  *
  * @link https://github.com/yiisoft/yii2/issues/810
  * @link http://www.yiiframework.com/forum/index.php/topic/21884-module-and-url-management/
  *
  * "user", "user/default", "user/admin", and "user/copy" work like normal
  * any other "user/xxx" gets changed to "user/default/xxx"
  *
  * @inheritdoc
  */
 public function createController($route)
 {
     // check valid routes
     $validRoutes = [$this->defaultRoute, "admin", "copy", "auth", "abonnement", 'company', "user-activities"];
     $isValidRoute = false;
     foreach ($validRoutes as $validRoute) {
         if (strpos($route, $validRoute) === 0) {
             $isValidRoute = true;
             break;
         }
     }
     return (empty($route) or $isValidRoute) ? parent::createController($route) : parent::createController("{$this->defaultRoute}/{$route}");
 }
開發者ID:jaccos,項目名稱:wrkmtspr_prd,代碼行數:26,代碼來源:Module.php


注:本文中的yii\base\Module::createController方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。