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


PHP Yaf_Dispatcher::getRouter方法代码示例

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


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

示例1: _initRoute

 public function _initRoute(Yaf_Dispatcher $dispatcher)
 {
     // 编辑员工
     $dispatcher->getRouter()->addRoute('staffUpdateRewrite', new Yaf_Route_Rewrite('/admin/staff/update/:userId', array('module' => 'admin', 'controller' => 'staff', 'action' => 'update')));
     // 删除员工
     $dispatcher->getRouter()->addRoute('staffDeleteRewrite', new Yaf_Route_Rewrite('/admin/staff/delete/:userId', array('module' => 'admin', 'controller' => 'staff', 'action' => 'delete')));
 }
开发者ID:yinliguo,项目名称:phpBase,代码行数:7,代码来源:Bootstrap.php

示例2: initYafBySooh

 /**
  * 
  * @param \Yaf_Dispatcher $dispatcher
  * @param  string $jqueryVer 使用的jquery文件,默认值:jquery-1.11.2.min.js
  * @return view
  */
 public static function initYafBySooh($dispatcher, $jqueryVer = 'jquery-1.11.2.min.js')
 {
     $router = $dispatcher->getRouter();
     $router->addRoute("byVar", new \Yaf_Route_Supervar(SOOH_ROUTE_VAR));
     \Yaf_Loader::getInstance()->registerLocalNameSpace($GLOBALS['CONF']['localLibs']);
     $req = $dispatcher->getRequest();
     $tmp = $req->get('__ONLY__');
     if ($tmp == 'body') {
         \SoohYaf\Viewext::$bodyonly = true;
     }
     $tmp = trim($req->get('__VIEW__'));
     //html(default),wap,  json
     define('VIW_INC_PATH', APP_PATH . '/application/views/_inc/');
     \SoohYaf\Viewext::$jqueryVer = $jqueryVer;
     if (!empty($tmp)) {
         $tmp = strtolower($tmp);
         \Sooh\Base\Ini::getInstance()->viewRenderType($tmp);
         if ($tmp == 'jsonp') {
             \Sooh\Base\Ini::getInstance()->initGobal(array('nameJsonP' => $req->get('jsonp', 'jsonp')));
         }
     }
     //		$tmp = $dispatcher->getRequest()->get('__GZIP__');
     //		if(!empty($tmp)){
     //			$tmp = strtolower ($tmp);
     //			if($tmp=='gzip')define("ZIP_OUTPUT",$tmp);
     //		}
     $view = new \SoohYaf\Viewext(null);
     $dispatcher->setView($view);
     $dispatcher->registerPlugin(new SoohPlugin());
     return $view;
 }
开发者ID:hillstill,项目名称:soohyaf,代码行数:37,代码来源:SoohPlugin.php

示例3: _initRoutes

 /**
  * [路由设置]
  */
 public function _initRoutes(Yaf_Dispatcher $dispatcher)
 {
     $router = $dispatcher->getRouter();
     //$router->addConfig(Yaf_Registry::get('config')->routes);
     Yaf_Loader::import(APP_CONFIG . '/route.php');
     $router->addConfig($routeConfigs);
 }
开发者ID:zhangxinvip,项目名称:YafUse,代码行数:10,代码来源:Bootstrap.php

示例4: _initRoute

 public function _initRoute(Yaf_Dispatcher $dispatcher)
 {
     $routes = $this->config->routes;
     if (!empty($routes)) {
         $router = $dispatcher->getRouter();
         $router->addConfig($routes);
     }
 }
开发者ID:liu33851861,项目名称:CZD_Yaf_Extension,代码行数:8,代码来源:Bootstrap.php

示例5: _initRoute

 public function _initRoute(Yaf_Dispatcher $dispatcher)
 {
     //在这里注册自己的路由协议,默认使用简单路由
     $fileName = APPLICATION_PATH . "/conf/routes.ini";
     if (file_exists($fileName)) {
         $config = new Yaf_Config_Ini($fileName);
         $dispatcher->getRouter()->addConfig($config->routes);
     }
 }
开发者ID:stonegithubs,项目名称:swoole-game,代码行数:9,代码来源:Bootstrap.php

示例6: _initRoute

 public function _initRoute(Yaf_Dispatcher $dispatcher)
 {
     //在这里注册自己的路由协议,默认使用简单路由
     $router = $dispatcher->getRouter();
     //创建一个路由协议实例
     $router->addRoute('index', new Yaf_Route_Regex('#^/$#', array('controller' => 'index', 'action' => 'index')));
     $router->addRoute('country', new Yaf_Route_Rewrite('route/:country', array('controller' => 'router', 'action' => 'country')));
     $router->addRoute('province', new Yaf_Route_Rewrite('route/:country/:province', array('controller' => 'router', 'action' => 'province')));
     $router->addRoute('city', new Yaf_Route_Rewrite('route/:country/:province/:city', array('controller' => 'router', 'action' => 'city')));
 }
开发者ID:jixiaod,项目名称:yaf-swoole-framework,代码行数:10,代码来源:Bootstrap.php

示例7: _initRoute

 public function _initRoute(Yaf_Dispatcher $dispatcher)
 {
     $router = $dispatcher->getRouter();
     //$router->addConfig(Yaf_Registry::get("config")->routes);
     //$route = new Yaf_Route_Rewrite(
     //	'exp/:ident',
     //	array(
     //		'controller' =>'index',
     //		'action' => 'index'
     //	)
     //);
     //$router -> addRoute('exp',$route);
     $route = new Yaf_Route_Rewrite('/admin/:action/:id', array('controller' => 'admin', 'action' => ':action'));
     $router->addRoute('name', $route);
 }
开发者ID:lifenglsf,项目名称:yafdemo,代码行数:15,代码来源:Bootstrap.php

示例8: _initRoute

 public function _initRoute(Yaf_Dispatcher $dispatcher)
 {
     $router = $dispatcher->getRouter();
     $router->addRoute("userlogin", new Yaf_Route_rewrite("/user/login", array('module' => 'user', 'controller' => "index", 'action' => "login")));
 }
开发者ID:sean0402,项目名称:yarf-framework,代码行数:5,代码来源:Bootstrap.php

示例9: _initRoute

 /**
  * 开启调试输出
  * @method _initRoute
  * @author NewFuture
  */
 public function _initRoute(Yaf_Dispatcher $dispatcher)
 {
     $dispatcher->getRouter()->addConfig(Config::get('routes'));
 }
开发者ID:derek-chow,项目名称:YunYinService,代码行数:9,代码来源:Bootstrap.php

示例10: header

 function _initBase(Yaf_Dispatcher $dispatcher)
 {
     // 如果非命令行,则输出 header 头
     if (!core::is_cmd()) {
         header("Expires: 0");
         header("Cache-Control: private, post-check=0, pre-check=0, max-age=0");
         header("Pragma: no-cache");
         header('Content-Type: text/html; charset=UTF-8');
         header('X-Powered-By: http://www.lianchuangbrothers.com/');
         // 隐藏 PHP 版本 X-Powered-By: PHP/5.5.9
         header('Server: Microsoft-IIS/11.11');
     }
     //错误处理
     $dispatcher->setErrorHandler([get_class($this), 'error_handler']);
     //添加路由协议
     $dispatcher->getRouter()->addConfig((new Yaf_Config_Ini(APP_PATH . '/conf/routes.ini'))->routes);
     //注册本地类
     Yaf_Loader::getInstance()->registerLocalNameSpace(['helper', 'misc']);
     // 加载数据库
     Yaf_Registry::set('db', new medoo(Yaf_Registry::get("config")->get('database')->default->toArray()));
     //memcache
     //Yaf_Registry::set('memcache', new Memcache);
     //Yaf_Registry::get('memcache')->pconnect(Yaf_Registry::get("config")->get('memcache')->default->host, Yaf_Registry::get("config")->get('memcache')->default->port, 2.5);
     //redis
     Yaf_Registry::set('redis', new redis());
     //连接redis
     Yaf_Registry::get('redis')->pconnect(Yaf_Registry::get("config")->get('redis')->default->host, Yaf_Registry::get("config")->get('redis')->default->port, 2.5);
     //redis密码
     Yaf_Registry::get('redis')->auth(Yaf_Registry::get("config")->get('redis')->default->password);
     //使用php内置的serialize/unserialize 方法对数据进行处理
     Yaf_Registry::get('redis')->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
     //rediskey加前缀
     Yaf_Registry::get('redis')->setOption(Redis::OPT_PREFIX, Yaf_Registry::get("config")->get('redis')->default->prefix);
     core::ob_start();
 }
开发者ID:290329416,项目名称:guahao,代码行数:35,代码来源:Bootstrap.php


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