1. <?php
  2. return array(
  3. // console 模式
  4. 'console'=>array(
  5. 'router' => array(
  6. //....
  7. ),
  8. ),
  9. // http 模式
  10. 'router' => array(
  11. 'router_class'=>null, // Zend\Mvc\Router\Http\TreeRouteStack 路由栈
  12. 'route_plugins'=>null, // Zend\Mvc\Router\RoutePluginManager 路由插件管理器
  13. 'default_params'=>array( // 默认参数
  14. 'key1'=>'key1_value',
  15. 'key2'=>'key2_value'
  16. ),
  17. 'prototypes'=>null, // 原型
  18. 'routes' => array(
  19. 'routename_Hostname' => array(
  20. /*
  21. 例子:
  22. 访问地址:
  23. http://www22.domain.com
  24.  
  25. 那么路由的参数是:
  26. array(
  27. 'controller'=>'Module1\Controller\Index',
  28. 'action' => 'index',
  29. 'subdomain'=>'www22',
  30. )
  31. */
  32. 'type' => 'Zend\Mvc\Router\Http\Hostname', // "路由匹配器"
  33. 'priority' => null, // 当前"路由匹配器"的权重
  34. 'options' => array( // 当前"路由匹配器"的配置
  35. 'route' => ':subdomain.domain.com', // 以www+2个数字开头的域名
  36. 'constraints' => array(
  37. 'subdomain' => 'www\d{2}', // 匹配表达式 "(^www\d{2}$)"
  38. ),
  39. 'defaults' => array(
  40. 'controller' => 'Module1\Controller\Index',
  41. 'action' => 'index',
  42. ),
  43. ),
  44. ),
  45. 'modules.domain.com' => array(
  46. /*
  47. 例子:
  48. 访问地址:
  49. http://modules.dev.domain.com
  50.  
  51. 那么路由的参数是:
  52. array(
  53. 'controller'=>'Module1\Controller\Index',
  54. 'action' => 'index',
  55. '4th'=>'modules',
  56. '3rd'=>'dev',
  57. '2nd'=>'domain',
  58. '1st'=>'com',
  59. )
  60. */
  61. 'type' => 'Zend\Mvc\Router\Http\Hostname',
  62. 'priority' => null,
  63. 'options' => array(
  64. 'route' => ':4th.[:3rd.]:2nd.:1st', // 匹配表达式 "(?P<param1>modules)(?:(?P<param2>.*?))?(?P<param3>domain)(?P<param4>com)"
  65. 'constraints' => array(
  66. '4th' => 'modules',
  67. '3rd' => '.*?', // 第三级可选域如:.ci, .dev 或 .test
  68. '2nd' => 'domain',
  69. '1st' => 'com',
  70. ),
  71. 'defaults' => array(
  72. 'controller' => 'Module1\Controller\Index',
  73. 'action' => 'index',
  74. )
  75. ),
  76. ),
  77. 'routename_Literal' => array(
  78. /*
  79. 例子:
  80. 访问地址:
  81. http://www.domain.com/test
  82.  
  83. 那么路由的参数是:
  84. array(
  85. 'controller'=>'Module1\Controller\TestController',
  86. 'action' => 'index',
  87. )
  88. */
  89. 'type' => 'Zend\Mvc\Router\Http\Literal',
  90. 'priority' => null,
  91. 'options' => array(
  92. 'route' => '/test', // 地址片段匹配
  93. 'defaults' => array(
  94. 'controller' => 'Module1\Controller\TestController',
  95. 'action' => 'index',
  96. ),
  97. ),
  98. ),
  99. 'routename_Literal' => array(
  100. /*
  101. 例子:
  102. ---------
  103. 访问地址:
  104. http://www.domain.com/
  105.  
  106. 那么路由的参数是:
  107. array(
  108. 'controller'=>'Module1\Controller\IndexController',
  109. 'action' => 'index',
  110. )
  111. ---------
  112. 访问地址:
  113. http://www.domain.com/blog
  114.  
  115. 那么路由的参数是:
  116. array(
  117. 'controller'=>'Module1\Controller\BlogController',
  118. 'action' => 'index',
  119. )
  120. ---------
  121. 访问地址:
  122. http://www.domain.com/album
  123.  
  124. 那么路由的参数是:
  125. array(
  126. 'controller'=>'Module1\Controller\AlbumController',
  127. 'action' => 'index',
  128. )
  129. */
  130. 'type' => 'Zend\Mvc\Router\Http\Literal',
  131. 'priority' => null,
  132. 'options' => array(
  133. 'route' => '/', // 地址片段匹配,如"/"开头
  134. 'defaults' => array(
  135. 'controller' => 'Module1\Controller\IndexController',
  136. 'action' => 'index',
  137. ),
  138. ),
  139. 'may_terminate' => true, // 是否匹配到立刻返回
  140. 'child_routes' => array( // 如果有配置child_routes,那么要降级作为 Zend\Mvc\Router\Http\Part 的内部对象
  141. 'blog' => array(
  142. 'type' => 'literal',
  143. 'options' => array(
  144. 'route' => '/blog', // 地址片段匹配,匹配的地址是 /blog
  145. 'defaults' => array(
  146. 'controller' => 'Module1\Controller\BlogController',
  147. 'action' => 'index',
  148. ),
  149. ),
  150. 'may_terminate' => true,
  151. 'child_routes' => array(
  152. ),
  153. ),
  154. 'album' => array(
  155. 'type' => 'Zend\Mvc\Router\Http\Segment',
  156. 'options' => array(
  157. 'route' => '/album[/:controller[/:action]]', // 匹配表达式 "/album(?:(?P<param1>/[a-zA-Z][a-zA-Z0-9_-]*)(?:(?P<param2>/[a-zA-Z][a-zA-Z0-9_-]*))?)?"
  158. 'constraints' => array(
  159. 'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
  160. 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
  161. ),
  162. 'defaults' => array(
  163. 'controller' => 'Module1\Controller\AlbumController',
  164. 'action' => 'index',
  165. ),
  166. ),
  167. ),
  168. ),
  169. ),
  170. 'routename_Method' => array(
  171. /*
  172. 例子:
  173. 访问地址:
  174. 在verb集合中的,都能匹配到
  175.  
  176. 那么路由的参数是:
  177. array(
  178. 'controller'=>'Module1\Controller\IndexController',
  179. 'action' => 'index',
  180. )
  181. */
  182. 'type' => 'Zend\Mvc\Router\Http\Method',
  183. 'priority' => null,
  184. 'options' => array(
  185. 'verb' => 'POST,GET,PUT,DELETE,HEAD', // 匹配请求方式
  186. 'defaults' => array(
  187. 'controller' => 'Module1\Controller\IndexController',
  188. 'action' => 'index',
  189. ),
  190. ),
  191. ),
  192. 'routename_Query' => array(
  193. /*
  194. 例子:
  195. 访问地址:
  196. 任何访问地址,都能匹配到
  197.  
  198. 那么路由的参数是:
  199. array(
  200. 'controller'=>'Module1\Controller\IndexController',
  201. 'action' => 'index',
  202. )
  203. */
  204. 'type' => 'Zend\Mvc\Router\Http\Query',
  205. 'priority' => null,
  206. 'options' => array( // 没有匹配规则
  207. 'defaults' => array(
  208. 'controller' => 'Module1\Controller\IndexController',
  209. 'action' => 'index',
  210. 'key1' => 'key1_value',
  211. ),
  212. ),
  213. ),
  214. 'routename_Regex' => array(
  215. /*
  216. 例子:
  217. 访问地址:
  218. http://www.domain.com/blog/ctrl1/act1
  219.  
  220. 那么路由的参数是:
  221. array(
  222. 'controller'=>'Module1\Controller\IndexController',
  223. 'action' => 'act1',
  224. 'format' => 'html',
  225. )
  226. */
  227. 'type' => 'Zend\Mvc\Router\Http\Regex',
  228. 'priority' => null,
  229. 'options' => array(
  230. 'regex'=>'/blog/(?P<controller>\w+)/(?P<action>\w+)', // 正则表达式匹配
  231. 'spec' => '/blog/%controller%/%action%',
  232. 'defaults' => array(
  233. 'controller' => 'Module1\Controller\IndexController',
  234. 'action' => 'index',
  235. 'format' => 'html',
  236. ),
  237. ),
  238. ),
  239. 'routename_Scheme' => array(
  240. /*
  241. 例子:
  242. 访问地址:
  243. scheme一致,都能匹配到
  244.  
  245. 那么路由的参数是:
  246. array(
  247. 'controller'=>'Module1\Controller\IndexController',
  248. 'action' => 'index',
  249. )
  250. */
  251. 'type' => 'Zend\Mvc\Router\Http\Scheme',
  252. 'priority' => null,
  253. 'options' => array(
  254. 'scheme'=>'https', // Scheme匹配
  255. 'defaults' => array(
  256. 'https' => true,
  257. ),
  258. ),
  259. ),
  260. 'routename_Segment' => array(
  261. /*
  262. 例子:
  263. 访问地址:
  264. scheme一致,都能匹配到
  265.  
  266. 那么路由的参数是:
  267. array(
  268. 'controller'=>'Module1\Controller\IndexController',
  269. 'action' => 'index',
  270. )
  271. */
  272. 'type' => 'Zend\Mvc\Router\Http\Segment',
  273. 'priority' => null,
  274. 'options' => array(
  275. 'route' => '/album[/:action][/:id]', // 匹配表达式 "/album(?:(?P<param1>/[a-zA-Z][a-zA-Z0-9_-]*))?(?:(?P<param2>/[0-9]+))?"
  276. 'constraints' => array(
  277. 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
  278. 'id' => '[0-9]+',
  279. ),
  280. 'defaults' => array(
  281. 'controller' => 'Module1\Controller\AlbumController',
  282. 'action' => 'index',
  283. ),
  284. ),
  285. ),
  286. 'routename_Wildcard' => array(
  287. /*
  288. 例子:
  289. 访问地址:
  290. http://www.domain.com/key1=key1_value/key2=key2_value
  291.  
  292. 那么路由的参数是:
  293. array(
  294. 'controller'=>'Module1\Controller\IndexController',
  295. 'action' => 'index',
  296. 'key1' => 'key1_value',
  297. 'key2' => 'key2_value',
  298. )
  299. */
  300. 'type' => 'Zend\Mvc\Router\Http\Wildcard',
  301. 'priority' => null,
  302. 'options' => array(
  303. 'param_delimiter'=>'/', // 两个参数之间的分隔符
  304. 'key_value_delimiter'=>'=', // 参数键值对的分隔符
  305. 'defaults' => array(
  306. 'controller' => 'Module1\Controller\Ctrl1',
  307. 'action' => 'index',
  308. ),
  309. ),
  310. ),
  311. )
  312. )
  313. );

ZendFramework-2.4 源代码 - 路由(类图)的更多相关文章

  1. PowerDesigner(八)-面向对象模型(用例图,序列图,类图,生成Java源代码及Java源代码生成类图)(转)

    面向对象模型 面向对象模型是利用UML(统一建模语言)的图形来描述系统结构的模型,它从不同角度实现系统的工作状态.这些图形有助于用户,管理人员,系统分析人员,开发人员,测试人员和其他人员之间进行信息交 ...

  2. 八、面向对象模型(用例图,序列图,类图,生成Java源代码及Java源代码生成类图)

    面向对象模型 面向对象模型是利用UML(统一建模语言)的图形来描述系统结构的模型,它从不同角度实现系统的工作状态.这些图形有助于用户,管理人员,系统分析人员,开发人员,测试人员和其他人员之间进行信息交 ...

  3. ZendFramework-2.4 源代码 - ViewManager类图

  4. [转]看懂UML类图

    这里不会将UML的各种元素都提到,我只想讲讲类图中各个类之间的关系: 能看懂类图中各个类之间的线条.箭头代表什么意思后,也就足够应对 日常的工作和交流: 同时,我们应该能将类图所表达的含义和最终的代码 ...

  5. 【PowerDesigner】【10】绘制类图

    前言:我感觉我也是一知半解,参考博客的内容会比我的文章更有帮助 用途:描述项目中类与类的关系(即描述java文件) 正文: 1,新建oomFile→New Model→Model types→Obje ...

  6. Rational Rose 2003 逆向工程转换C++ / VC++ 6.0源代码成UML类图

    目录 1.安装&破解Rational Rose 2003 1.1 安装Rose 2003 1.2 破解Rose 2003 1.3运行出错“没有找到suite objects.dl” 2. Ra ...

  7. Rational Rose 2003 逆向工程转换C++源代码成UML类图

    主要介绍用户如何使用Rose的逆向工程生成UML模型,并用来进行C++代码的结构分析. Rational Rose可以支持标准C++和Visual C++的模型到代码的转换以及逆向工程.下面将详细地说 ...

  8. [.net 面向对象程序设计深入](1)UML——在Visual Studio 2013/2015中设计UML类图

    [.net 面向对象程序设计深入](1)UML——在Visual Studio 2013/2015中设计UML类图 1.UML简介 Unified Modeling Language (UML)又称统 ...

  9. UML——在Visual Studio 2013/2015中设计UML类图

    1.UML简介 Unified Modeling Language (UML)又称统一建模语言或标准建模语言. 简单说就是以图形方式表现模型,根据不同模型进行分类,在UML 2.0中有13种图,以下是 ...

  10. intellij idea 高级用法之:集成JIRA、UML类图插件、集成SSH、集成FTP、Database管理

    之前写过一篇IntelliJ IDEA 13试用手记,idea还有很多高大上的功能,易用性几乎能与vs.net媲美,反正我自从改用idea后,再也没开过eclipse,今天来看几个高级功能: 一.与J ...

随机推荐

  1. (转)深入浅出linux系统umask值及其对应的文件权限讲解

    浅出linux系统umask值及其对应的文件权限讲解 原文:http://blog.51cto.com/oldboy/1060032 缘起:1.此文的撰写特别为感谢51cto的博客工作人员和领导,老男 ...

  2. 用命令行的方式将本地项目上传到git

    1.(先进入项目文件夹)通过命令 git init 把这个目录变成git可以管理的仓库 git init 2.把文件添加到版本库中,使用命令 git add .添加到暂存区里面去,不要忘记后面的小数点 ...

  3. webpack.config.js====CSS相关:插件optimize-css-assets-webpack-plugin

    1. 安装:主要是用来压缩css文件 cnpm install --save-dev optimize-css-assets-webpack-plugin cssnano 2. webpack.con ...

  4. C 碎片六 函数

    一.程序编译执行过程 程序的编译执行过程分为4个阶段:预处理阶段.编译阶段.汇编阶段.连接阶段 1. 预处理阶段:预处理器(cpp)处理以头文件.宏.条件编译(字符#开头)等内容的替换.此阶段不进行语 ...

  5. linux系统的安全小知识

    最近安装linux虚拟机,出了几个小问题:1. 只有root用户  2.ftp连接不上  3.ssh连接虚拟机如何免密 1.创建用户 useradd –d /usr/sam -m sam    创建用 ...

  6. php 04

    前加加(++$a) 先运算后赋值 后加加($a++) 先赋值后运算 -- 前减减(--$a) 先运算后赋值 后减减($a--) 先赋值后运算 连接运算符(字符串运算符) . 神奇的米粒 1. 字符串和 ...

  7. Diagnostics->Examine功能不能使用

    在获取字段来源时: 执行Help->Diagnostics->Examine 系统弹出

  8. Spring MVC的测试

    测试是保证软件质量的关键. 与 Spring MVC 相关的测试,主要涉及控制器的测试. 为了测试Web项目通常不需要启动项目,需要一些Servlet相关的一些模拟对象,比如MockMVC.MockH ...

  9. c#中反射技术在Unity中的运用

    反射技术给类赋值的好处就是可以简化代码,封装的好处就显而易见了.最直接的用途就是用在在显示配置文件的时候,个人习惯性做法是做一个VO来存储需要的数据,其代码如下: internal class Bas ...

  10. VS功能扩展--扩展介绍

    使用Eclipse的朋友都知道Eclipse是一个完全可扩展的IDE,那么在windows程序开发时,我们常使用的IDE(Visual studio)是否具有功能的扩展性呢?毫无疑问,回答是肯定的.我 ...