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


PHP Parameter::unsetAllParams方法代码示例

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


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

示例1: prepare


//.........这里部分代码省略.........
     if ($_SERVER['REQUEST_METHOD'] == 'GET') {
         $keys = array_keys($_GET);
         //get URL after '?'
     } else {
         $qstringPieces = explode('&', $_SERVER['QUERY_STRING']);
         foreach ($qstringPieces as $key => $value) {
             $x = explode('=', $value);
             $value = isset($x[1]) ? $x[1] : "";
             $this->key_val_pairs[$x[0]] = $value;
             $this->qstring_keys[$x[0]];
         }
         $keys = array_keys($_POST);
         //get form variables
     }
     foreach ($keys as $key => $value) {
         if ($_SERVER['REQUEST_METHOD'] == 'GET') {
             //make to lower case
             $this->key_val_pairs[strtolower($value)] = $_GET[$value];
         } else {
             //make to lower case
             $this->key_val_pairs[strtolower($value)] = $_POST[$value];
         }
     }
     if ($moduleKeyword == $controllerKeyword || $actionKeyword == $controllerKeyword || $moduleKeyword == $actionKeyword) {
         throw new AiryException("Duplicate MVC Keywords. Module's, Controller's and Action's keywords should be unique.");
     }
     // setup module first
     if (!empty($this->key_val_pairs[$moduleKeyword])) {
         $this->moduleName = RouterHelper::hyphenToCamelCase($this->key_val_pairs[$moduleKeyword]);
         //module name
         $this->setModule($this->moduleName);
         unset($this->key_val_pairs[$moduleKeyword]);
     } else {
         $this->moduleName = $config->getDefaultModule();
         //no module name means "default" module
         $this->setModule($this->moduleName);
     }
     //Set Controller Name; also set the default model and view here
     //Controller's first letter is upper case
     if (!empty($this->key_val_pairs[$controllerKeyword])) {
         $this->controllerName = RouterHelper::hyphenToCamelCase($this->key_val_pairs[$controllerKeyword], TRUE);
         $this->setDefaultModelView($this->controllerName);
         MvcReg::setControllerName($this->controllerName);
         $this->controller = $this->controllerName . self::CONTROLLER_POSTFIX;
         //controller name
         unset($this->key_val_pairs[$controllerKeyword]);
     } else {
         $this->controllerName = ucfirst(self::DEFAULT_PREFIX);
         $this->controller = $this->controllerName . self::CONTROLLER_POSTFIX;
         $this->setDefaultModelView(self::DEFAULT_PREFIX);
         MvcReg::setControllerName($this->controllerName);
     }
     //Setting action
     if (!empty($this->key_val_pairs[$actionKeyword])) {
         $this->actionName = RouterHelper::hyphenToCamelCase($this->key_val_pairs[$actionKeyword]);
         MvcReg::setActionName($this->actionName);
         $this->action = RouterHelper::hyphenToCamelCase($this->key_val_pairs[$actionKeyword]) . self::ACTION_POSTFIX;
         //action name
         unset($this->key_val_pairs[$actionKeyword]);
     } else {
         $this->actionName = self::DEFAULT_PREFIX;
         MvcReg::setActionName($this->actionName);
         $this->action = self::DEFAULT_PREFIX . self::ACTION_POSTFIX;
     }
     $this->setDefaultActionView($this->controllerName, $this->actionName);
     $this->setModuleControllerAction($this->moduleName, $this->controllerName, $this->actionName);
     //Setting language code and Session
     if (!empty($this->key_val_pairs[$languageKeyword])) {
         $this->languageCode = $this->key_val_pairs[$languageKeyword];
         $this->setLanguageCode($this->languageCode);
         //set langauge session based on module
         //@TODO: need to consider to add a project layer in the futuure
         $_SESSION[$this->moduleName][self::LANGUAGE_CODE] = $this->languageCode;
         unset($this->key_val_pairs[$languageKeyword]);
     } else {
         if (!empty($_SESSION[$this->moduleName][self::LANGUAGE_CODE])) {
             $this->setLanguageCode($_SESSION[$this->moduleName][self::LANGUAGE_CODE]);
         } else {
             $this->setLanguageCode($defaultLanguageCode);
             //@TODO: need to consider to add a project layer in the futuure
             $_SESSION[$this->moduleName][self::LANGUAGE_CODE] = $defaultLanguageCode;
         }
     }
     //Getting serialize data for setting authentication allowing actions
     if (!empty($this->key_val_pairs[self::ALLOW_THIS_ACTION])) {
         if (isset($this->key_val_pairs[self::ALLOW_THIS_ACTION])) {
             $filename = $this->key_val_pairs[self::ALLOW_THIS_ACTION];
             $checkContent = $this->moduleName . ";" . $this->controllerName . ";" . $this->actionName;
             $checkContent = md5($checkContent);
             if (trim(FileCache::getFile($filename)) == trim($checkContent)) {
                 Authentication::addLayoutAllowAction($this->moduleName, $this->controllerName, $this->actionName);
                 FileCache::removeFile($filename);
             }
         }
         unset($this->key_val_pairs[self::ALLOW_THIS_ACTION]);
     }
     $this->params = $this->key_val_pairs;
     Parameter::unsetAllParams();
     Parameter::setParams($this->params);
 }
开发者ID:airymvc,项目名称:airymvc2,代码行数:101,代码来源:Router.php


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