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


PHP WindUrlHelper::resolveAction方法代码示例

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


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

示例1: build

 /**
  * 在此路由协议的基础上组装url
  *
  * @param AbstractWindRouter $router
  * @param string $action 格式为app/module/controller/action
  * @param array $args 附带的参数
  * @return string
  * @see AbstractWindRoute::build()
  */
 public function build($router, $action, $args = array())
 {
     list($_a, $_c, $_m, $_p, $args) = WindUrlHelper::resolveAction($action, $args);
     $flag = 0;
     foreach ($this->params as $key => $val) {
         if (!isset($val['map'])) {
             continue;
         }
         if ($key === $router->getModuleKey()) {
             $m = $_m ? $_m : $router->getModule();
             if ($m === $router->getDefaultModule() && $flag & 2) {
                 $flag = 7;
             } else {
                 $_args[$val['map']] = $m;
             }
         } elseif ($key === $router->getControllerKey()) {
             $c = $_c ? $_c : $router->getController();
             if ($c === $router->getDefaultController() && $flag & 1) {
                 $flag = 3;
             } else {
                 $_args[$val['map']] = $c;
             }
         } elseif ($key === $router->getActionKey()) {
             $a = $_a ? $_a : $router->getAction();
             if ($a === $router->getDefaultAction()) {
                 $flag = 1;
             } else {
                 $_args[$val['map']] = $a;
             }
         } else {
             if (isset($args[$key])) {
                 $_args[$val['map']] = $args[$key];
             } elseif (isset($val['value'])) {
                 $_args[$val['map']] = $val['value'];
             } else {
                 $_args[$val['map']] = '';
             }
         }
         unset($args[$key]);
     }
     $mulitipyTime = count($_args);
     $_args[0] = str_repeat($this->reverse, $mulitipyTime);
     ksort($_args);
     $url = call_user_func_array("sprintf", $_args);
     $args && ($url .= '?' . WindUrlHelper::argsToUrl($args, true, $this->separator));
     $baseUrl = Wind::getApp()->getRequest()->getBaseUrl(true);
     $_baseUrl = $_p ? $this->replaceStr($baseUrl, $_p) : $baseUrl;
     return trim($_baseUrl, '/') . '/' . trim($url, '/');
 }
开发者ID:jellycheng,项目名称:windframework,代码行数:58,代码来源:WindRewriteRoute.php

示例2: build

 public function build($router, $action, $args = array())
 {
     list($_a, $_c, $_m, $args) = WindUrlHelper::resolveAction($action, $args);
     if ($_m && $_m !== $router->getDefaultModule()) {
         $args[$router->getModuleKey()] = $_m;
     }
     if ($_c && $_c !== $router->getDefaultController()) {
         $args[$router->getControllerKey()] = $_c;
     }
     if ($_a && $_a !== $router->getDefaultAction()) {
         $args[$router->getActionKey()] = $_a;
     }
     $_url = 'index.php?' . WindUrlHelper::argsToUrl($args);
     return $_url;
 }
开发者ID:BTSnowball,项目名称:BTSnowball_Users_Hand,代码行数:15,代码来源:PwCommonRoute.php

示例3: dispatchWithAction

 /**
  * 重定向请求到新的action操作
  * 
  * 该种重定向类型,是中断当前的请求执行过程,开启另外的action操作处理.是在一次请求内部进行重定向,
  * 所以之前的一些处理的结果变量,在重定向后是会继续存在,并可通过forward变量进行访问的.也就是不仅仅是过程的重定向,
  * 也是状态的重定向.
  * @param WindForward $forward
  * @param WindRouter $router
  * @param boolean $display
  * @return void
  */
 protected function dispatchWithAction($forward, $router, $display)
 {
     if (!($action = $forward->getAction())) {
         throw new WindException('[web.WindDispatcher.dispatchWithAction] forward fail.', WindException::ERROR_PARAMETER_TYPE_ERROR);
     }
     $this->display = $display;
     list($_a, $_c, $_m) = WindUrlHelper::resolveAction($action);
     if ($_var = $forward->getArgs()) {
         $this->getResponse()->setData($_var, 'F');
     }
     $_a && $router->setAction($_a);
     $_c && $router->setController($_c);
     $_m && $router->setModule($_m);
     Wind::getApp()->run();
 }
开发者ID:jellycheng,项目名称:windframework,代码行数:26,代码来源:WindDispatcher.php

示例4: dispatchWithAction

 /**
  * 重定向请求到新的action操作
  * 
  * 该种重定向类型,是中断当前的请求执行过程,开启另外的action操作处理.是在一次请求内部进行重定向,
  * 所以之前的一些处理的结果变量,在重定向后是会继续存在,并可通过forward变量进行访问的.也就是不仅仅是过程的重定向,
  * 也是状态的重定向.
  * @param WindForward $forward
  * @param WindRouter $router
  * @param boolean $display
  * @return void
  */
 protected function dispatchWithAction($forward, $router, $display)
 {
     if (!($action = $forward->getAction())) {
         throw new WindException('[web.WindDispatcher.dispatchWithAction] forward fail.', WindException::ERROR_PARAMETER_TYPE_ERROR);
     }
     $this->display = $display;
     list($_a, $_c, $_m, $arg) = WindUrlHelper::resolveAction($action);
     foreach ($arg as $key => $value) {
         $_GET[$key] = $value;
     }
     foreach ($forward->getArgs() as $key => $value) {
         $_POST[$key] = $value;
     }
     $_a && $router->setAction($_a);
     $_c && $router->setController($_c);
     $_m && $router->setModule($_m);
     Wind::getApp()->run();
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:29,代码来源:WindDispatcher.php

示例5: assemble

 public function assemble($action, $args = array(), $route = null)
 {
     $route || ($route = $this->defaultRoute);
     if ($route && null !== ($route = $this->getRoute($route))) {
         $_url = $route->build($this, $action, $args);
     } else {
         list($_a, $_c, $_m, $args) = WindUrlHelper::resolveAction($action, $args);
         if ($_m && $_m !== $this->_module) {
             $args[$this->moduleKey] = $_m;
         }
         if ($_c && $_c !== $this->_controller) {
             $args[$this->controllerKey] = $_c;
         }
         if ($_a && $_a !== $this->_action) {
             $args[$this->actionKey] = $_a;
         }
         $_url = $this->request->getScript() . '?' . WindUrlHelper::argsToUrl($args);
     }
     return $_url;
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:20,代码来源:WindRouter.php

示例6: build

 /**
  * 在此路由协议的基础上组装url
  *
  * @param AbstractWindRouter $router        	
  * @param string $action
  *        	格式为app/module/controller/action
  * @param array $args
  *        	附带的参数
  * @return string
  * @see AbstractWindRoute::build()
  */
 public function build($router, $action, $args = array())
 {
     list($_a, $_c, $_m, $_p, $args) = WindUrlHelper::resolveAction($action, $args);
     foreach ($this->params as $key => $val) {
         if ($key === $router->getModuleKey()) {
             $_m || ($_m = $router->getModule());
             $_args[$val] = $_m;
         } elseif ($key === $router->getControllerKey()) {
             $_c || ($_c = $router->getController());
             $_args[$val] = $_c;
         } elseif ($key === $router->getActionKey()) {
             $_a || ($_a = $router->getAction());
             $_args[$val] = $_a;
         }
         unset($args[$key]);
     }
     $_args[0] = $this->reverse;
     ksort($_args);
     $url = call_user_func_array("sprintf", $_args);
     $args && ($url .= '/' . WindUrlHelper::argsToUrl($args, true, $this->separator));
     return trim($url, '/');
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:33,代码来源:WindRewriteRoute.php

示例7: _matchPath

 /**
  * 解析url串
  *
  * @param WindHttpRequest $request        	
  * @param string $path        	
  * @return array
  */
 private function _matchPath($path, $rawDecode = false)
 {
     $path = trim($path, '/');
     if (empty($path)) {
         return array();
     }
     if ($this->rewrite_special) {
         /* 解析特殊伪静态 */
         $rule = $this->_getRule();
         if (!empty($rule)) {
             if (false !== strpos($path, '?')) {
                 list($rewritePath, $queryPath) = explode('?', $path . '?', 2);
             } else {
                 list($rewritePath, $queryPath) = explode('&', $path . '&', 2);
             }
             foreach ($rule as $k => $v) {
                 if ($k == 'default') {
                     continue;
                 }
                 $rewritePath = rawurldecode($rewritePath);
                 if (preg_match($v['pattern'], $rewritePath, $matches)) {
                     $matches = array_diff_key($matches, range(0, intval(count($matches) / 2)));
                     $args = WindUrlHelper::urlToArgs(trim($queryPath, '?'), true);
                     if ($k == 'thread' || $k == 'cate') {
                         if (!isset($matches['fid']) && isset($matches['fname'])) {
                             $domain = $this->_getDomain('domain', 'domain_key');
                             if (isset($domain[$matches['fname']])) {
                                 list($_a, $_c, $_m, $_args) = WindUrlHelper::resolveAction($domain[$matches['fname']]);
                                 return array_merge($matches, array('m' => $_m, 'c' => $_c, 'a' => $_a), $_args + $args);
                             }
                         } elseif (isset($matches['fid'])) {
                             $forum = Wekit::load('forum.PwForum')->getForum($matches['fid']);
                             $action = array('category' => array('m' => 'bbs', 'c' => 'cate', 'a' => 'run'), 'forum' => array('m' => 'bbs', 'c' => 'thread', 'a' => 'run'), 'sub' => array('m' => 'bbs', 'c' => 'thread', 'a' => 'run'), 'sub2' => array('m' => 'bbs', 'c' => 'thread', 'a' => 'run'));
                             $forum_type = isset($forum['type']) ? $forum['type'] : 'forum';
                             return array_merge($matches, $action[$forum_type], $args);
                         }
                     }
                     $route = explode('/', $v['route']);
                     return array_merge($matches, array('m' => $route[0], 'c' => $route[1], 'a' => $route[2]), $args);
                 }
             }
         }
     }
     /* 解析普通伪静态 */
     if ($this->rewrite_common && strpos($path, '.php') === false) {
         return $this->_matchCommon($path);
     }
     $r = false !== strpos($path, '?') ? WindUrlHelper::urlToArgs($path) : array();
     if ($rawDecode) {
         return $r;
     }
     $return = array();
     if (isset($r['m']) || isset($r['c']) || isset($r['a'])) {
         $return['m'] = isset($r['m']) ? $r['m'] : $this->default_m;
         $return['c'] = isset($r['c']) ? $r['c'] : 'index';
         $return['a'] = isset($r['a']) ? $r['a'] : 'run';
     }
     return $return;
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:66,代码来源:PwRoute.php

示例8: flushDomain

 /**
  * 更新某个首字母的缓存
  *
  * @param char $first
  */
 public function flushDomain()
 {
     $domain = $app = array();
     $forum_isopen = Wekit::C('domain', "forum.isopen");
     $result = $this->_domainDs()->getAll();
     foreach ($result as $v) {
         if ($v['domain_type'] == 'forum' && !$forum_isopen) {
             continue;
         }
         $k = 'http://' . $v['domain'] . '.' . $v['root'];
         $domain[$k] = $v['domain_key'];
         if ($v['domain_type'] == 'app') {
             list(, , $m) = WindUrlHelper::resolveAction($v['domain_key']);
             $app[$m] = $k;
         }
     }
     Wekit::load('config.PwConfig')->setConfig('site', 'domain', $domain);
     Wekit::load('config.PwConfig')->setConfig('site', 'domain.app', $app);
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:24,代码来源:PwDomainService.php

示例9: testResolveAction

 /**
  * Tests WindUrlHelper::resolveAction()
  */
 public function testResolveAction()
 {
     $this->assertEquals(array('action', 'controller', 'module', 'app', array('c' => 'c', 'b' => 'b')), WindUrlHelper::resolveAction("app/module/controller/action?b=b", array('c' => 'c')));
 }
开发者ID:jellycheng,项目名称:windframework,代码行数:7,代码来源:WindUrlHelperTest.php


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