ZendFramework-2.4 源代码 - 路由(类图)
- <?php
- return array(
- // console 模式
- 'console'=>array(
- 'router' => array(
- //....
- ),
- ),
- // http 模式
- 'router' => array(
- 'router_class'=>null, // Zend\Mvc\Router\Http\TreeRouteStack 路由栈
- 'route_plugins'=>null, // Zend\Mvc\Router\RoutePluginManager 路由插件管理器
- 'default_params'=>array( // 默认参数
- 'key1'=>'key1_value',
- 'key2'=>'key2_value'
- ),
- 'prototypes'=>null, // 原型
- 'routes' => array(
- 'routename_Hostname' => array(
- /*
- 例子:
- 访问地址:
- http://www22.domain.com
- 那么路由的参数是:
- array(
- 'controller'=>'Module1\Controller\Index',
- 'action' => 'index',
- 'subdomain'=>'www22',
- )
- */
- 'type' => 'Zend\Mvc\Router\Http\Hostname', // "路由匹配器"
- 'priority' => null, // 当前"路由匹配器"的权重
- 'options' => array( // 当前"路由匹配器"的配置
- 'route' => ':subdomain.domain.com', // 以www+2个数字开头的域名
- 'constraints' => array(
- 'subdomain' => 'www\d{2}', // 匹配表达式 "(^www\d{2}$)"
- ),
- 'defaults' => array(
- 'controller' => 'Module1\Controller\Index',
- 'action' => 'index',
- ),
- ),
- ),
- 'modules.domain.com' => array(
- /*
- 例子:
- 访问地址:
- http://modules.dev.domain.com
- 那么路由的参数是:
- array(
- 'controller'=>'Module1\Controller\Index',
- 'action' => 'index',
- '4th'=>'modules',
- '3rd'=>'dev',
- '2nd'=>'domain',
- '1st'=>'com',
- )
- */
- 'type' => 'Zend\Mvc\Router\Http\Hostname',
- 'priority' => null,
- 'options' => array(
- 'route' => ':4th.[:3rd.]:2nd.:1st', // 匹配表达式 "(?P<param1>modules)(?:(?P<param2>.*?))?(?P<param3>domain)(?P<param4>com)"
- 'constraints' => array(
- '4th' => 'modules',
- '3rd' => '.*?', // 第三级可选域如:.ci, .dev 或 .test
- '2nd' => 'domain',
- '1st' => 'com',
- ),
- 'defaults' => array(
- 'controller' => 'Module1\Controller\Index',
- 'action' => 'index',
- )
- ),
- ),
- 'routename_Literal' => array(
- /*
- 例子:
- 访问地址:
- http://www.domain.com/test
- 那么路由的参数是:
- array(
- 'controller'=>'Module1\Controller\TestController',
- 'action' => 'index',
- )
- */
- 'type' => 'Zend\Mvc\Router\Http\Literal',
- 'priority' => null,
- 'options' => array(
- 'route' => '/test', // 地址片段匹配
- 'defaults' => array(
- 'controller' => 'Module1\Controller\TestController',
- 'action' => 'index',
- ),
- ),
- ),
- 'routename_Literal' => array(
- /*
- 例子:
- ---------
- 访问地址:
- http://www.domain.com/
- 那么路由的参数是:
- array(
- 'controller'=>'Module1\Controller\IndexController',
- 'action' => 'index',
- )
- ---------
- 访问地址:
- http://www.domain.com/blog
- 那么路由的参数是:
- array(
- 'controller'=>'Module1\Controller\BlogController',
- 'action' => 'index',
- )
- ---------
- 访问地址:
- http://www.domain.com/album
- 那么路由的参数是:
- array(
- 'controller'=>'Module1\Controller\AlbumController',
- 'action' => 'index',
- )
- */
- 'type' => 'Zend\Mvc\Router\Http\Literal',
- 'priority' => null,
- 'options' => array(
- 'route' => '/', // 地址片段匹配,如"/"开头
- 'defaults' => array(
- 'controller' => 'Module1\Controller\IndexController',
- 'action' => 'index',
- ),
- ),
- 'may_terminate' => true, // 是否匹配到立刻返回
- 'child_routes' => array( // 如果有配置child_routes,那么要降级作为 Zend\Mvc\Router\Http\Part 的内部对象
- 'blog' => array(
- 'type' => 'literal',
- 'options' => array(
- 'route' => '/blog', // 地址片段匹配,匹配的地址是 /blog
- 'defaults' => array(
- 'controller' => 'Module1\Controller\BlogController',
- 'action' => 'index',
- ),
- ),
- 'may_terminate' => true,
- 'child_routes' => array(
- ),
- ),
- 'album' => array(
- 'type' => 'Zend\Mvc\Router\Http\Segment',
- 'options' => array(
- 'route' => '/album[/:controller[/:action]]', // 匹配表达式 "/album(?:(?P<param1>/[a-zA-Z][a-zA-Z0-9_-]*)(?:(?P<param2>/[a-zA-Z][a-zA-Z0-9_-]*))?)?"
- 'constraints' => array(
- 'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
- 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
- ),
- 'defaults' => array(
- 'controller' => 'Module1\Controller\AlbumController',
- 'action' => 'index',
- ),
- ),
- ),
- ),
- ),
- 'routename_Method' => array(
- /*
- 例子:
- 访问地址:
- 在verb集合中的,都能匹配到
- 那么路由的参数是:
- array(
- 'controller'=>'Module1\Controller\IndexController',
- 'action' => 'index',
- )
- */
- 'type' => 'Zend\Mvc\Router\Http\Method',
- 'priority' => null,
- 'options' => array(
- 'verb' => 'POST,GET,PUT,DELETE,HEAD', // 匹配请求方式
- 'defaults' => array(
- 'controller' => 'Module1\Controller\IndexController',
- 'action' => 'index',
- ),
- ),
- ),
- 'routename_Query' => array(
- /*
- 例子:
- 访问地址:
- 任何访问地址,都能匹配到
- 那么路由的参数是:
- array(
- 'controller'=>'Module1\Controller\IndexController',
- 'action' => 'index',
- )
- */
- 'type' => 'Zend\Mvc\Router\Http\Query',
- 'priority' => null,
- 'options' => array( // 没有匹配规则
- 'defaults' => array(
- 'controller' => 'Module1\Controller\IndexController',
- 'action' => 'index',
- 'key1' => 'key1_value',
- ),
- ),
- ),
- 'routename_Regex' => array(
- /*
- 例子:
- 访问地址:
- http://www.domain.com/blog/ctrl1/act1
- 那么路由的参数是:
- array(
- 'controller'=>'Module1\Controller\IndexController',
- 'action' => 'act1',
- 'format' => 'html',
- )
- */
- 'type' => 'Zend\Mvc\Router\Http\Regex',
- 'priority' => null,
- 'options' => array(
- 'regex'=>'/blog/(?P<controller>\w+)/(?P<action>\w+)', // 正则表达式匹配
- 'spec' => '/blog/%controller%/%action%',
- 'defaults' => array(
- 'controller' => 'Module1\Controller\IndexController',
- 'action' => 'index',
- 'format' => 'html',
- ),
- ),
- ),
- 'routename_Scheme' => array(
- /*
- 例子:
- 访问地址:
- scheme一致,都能匹配到
- 那么路由的参数是:
- array(
- 'controller'=>'Module1\Controller\IndexController',
- 'action' => 'index',
- )
- */
- 'type' => 'Zend\Mvc\Router\Http\Scheme',
- 'priority' => null,
- 'options' => array(
- 'scheme'=>'https', // Scheme匹配
- 'defaults' => array(
- 'https' => true,
- ),
- ),
- ),
- 'routename_Segment' => array(
- /*
- 例子:
- 访问地址:
- scheme一致,都能匹配到
- 那么路由的参数是:
- array(
- 'controller'=>'Module1\Controller\IndexController',
- 'action' => 'index',
- )
- */
- 'type' => 'Zend\Mvc\Router\Http\Segment',
- 'priority' => null,
- 'options' => array(
- 'route' => '/album[/:action][/:id]', // 匹配表达式 "/album(?:(?P<param1>/[a-zA-Z][a-zA-Z0-9_-]*))?(?:(?P<param2>/[0-9]+))?"
- 'constraints' => array(
- 'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
- 'id' => '[0-9]+',
- ),
- 'defaults' => array(
- 'controller' => 'Module1\Controller\AlbumController',
- 'action' => 'index',
- ),
- ),
- ),
- 'routename_Wildcard' => array(
- /*
- 例子:
- 访问地址:
- http://www.domain.com/key1=key1_value/key2=key2_value
- 那么路由的参数是:
- array(
- 'controller'=>'Module1\Controller\IndexController',
- 'action' => 'index',
- 'key1' => 'key1_value',
- 'key2' => 'key2_value',
- )
- */
- 'type' => 'Zend\Mvc\Router\Http\Wildcard',
- 'priority' => null,
- 'options' => array(
- 'param_delimiter'=>'/', // 两个参数之间的分隔符
- 'key_value_delimiter'=>'=', // 参数键值对的分隔符
- 'defaults' => array(
- 'controller' => 'Module1\Controller\Ctrl1',
- 'action' => 'index',
- ),
- ),
- ),
- )
- )
- );
ZendFramework-2.4 源代码 - 路由(类图)的更多相关文章
- PowerDesigner(八)-面向对象模型(用例图,序列图,类图,生成Java源代码及Java源代码生成类图)(转)
面向对象模型 面向对象模型是利用UML(统一建模语言)的图形来描述系统结构的模型,它从不同角度实现系统的工作状态.这些图形有助于用户,管理人员,系统分析人员,开发人员,测试人员和其他人员之间进行信息交 ...
- 八、面向对象模型(用例图,序列图,类图,生成Java源代码及Java源代码生成类图)
面向对象模型 面向对象模型是利用UML(统一建模语言)的图形来描述系统结构的模型,它从不同角度实现系统的工作状态.这些图形有助于用户,管理人员,系统分析人员,开发人员,测试人员和其他人员之间进行信息交 ...
- ZendFramework-2.4 源代码 - ViewManager类图
- [转]看懂UML类图
这里不会将UML的各种元素都提到,我只想讲讲类图中各个类之间的关系: 能看懂类图中各个类之间的线条.箭头代表什么意思后,也就足够应对 日常的工作和交流: 同时,我们应该能将类图所表达的含义和最终的代码 ...
- 【PowerDesigner】【10】绘制类图
前言:我感觉我也是一知半解,参考博客的内容会比我的文章更有帮助 用途:描述项目中类与类的关系(即描述java文件) 正文: 1,新建oomFile→New Model→Model types→Obje ...
- 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 ...
- Rational Rose 2003 逆向工程转换C++源代码成UML类图
主要介绍用户如何使用Rose的逆向工程生成UML模型,并用来进行C++代码的结构分析. Rational Rose可以支持标准C++和Visual C++的模型到代码的转换以及逆向工程.下面将详细地说 ...
- [.net 面向对象程序设计深入](1)UML——在Visual Studio 2013/2015中设计UML类图
[.net 面向对象程序设计深入](1)UML——在Visual Studio 2013/2015中设计UML类图 1.UML简介 Unified Modeling Language (UML)又称统 ...
- UML——在Visual Studio 2013/2015中设计UML类图
1.UML简介 Unified Modeling Language (UML)又称统一建模语言或标准建模语言. 简单说就是以图形方式表现模型,根据不同模型进行分类,在UML 2.0中有13种图,以下是 ...
- intellij idea 高级用法之:集成JIRA、UML类图插件、集成SSH、集成FTP、Database管理
之前写过一篇IntelliJ IDEA 13试用手记,idea还有很多高大上的功能,易用性几乎能与vs.net媲美,反正我自从改用idea后,再也没开过eclipse,今天来看几个高级功能: 一.与J ...
随机推荐
- (转)深入浅出linux系统umask值及其对应的文件权限讲解
浅出linux系统umask值及其对应的文件权限讲解 原文:http://blog.51cto.com/oldboy/1060032 缘起:1.此文的撰写特别为感谢51cto的博客工作人员和领导,老男 ...
- 用命令行的方式将本地项目上传到git
1.(先进入项目文件夹)通过命令 git init 把这个目录变成git可以管理的仓库 git init 2.把文件添加到版本库中,使用命令 git add .添加到暂存区里面去,不要忘记后面的小数点 ...
- webpack.config.js====CSS相关:插件optimize-css-assets-webpack-plugin
1. 安装:主要是用来压缩css文件 cnpm install --save-dev optimize-css-assets-webpack-plugin cssnano 2. webpack.con ...
- C 碎片六 函数
一.程序编译执行过程 程序的编译执行过程分为4个阶段:预处理阶段.编译阶段.汇编阶段.连接阶段 1. 预处理阶段:预处理器(cpp)处理以头文件.宏.条件编译(字符#开头)等内容的替换.此阶段不进行语 ...
- linux系统的安全小知识
最近安装linux虚拟机,出了几个小问题:1. 只有root用户 2.ftp连接不上 3.ssh连接虚拟机如何免密 1.创建用户 useradd –d /usr/sam -m sam 创建用 ...
- php 04
前加加(++$a) 先运算后赋值 后加加($a++) 先赋值后运算 -- 前减减(--$a) 先运算后赋值 后减减($a--) 先赋值后运算 连接运算符(字符串运算符) . 神奇的米粒 1. 字符串和 ...
- Diagnostics->Examine功能不能使用
在获取字段来源时: 执行Help->Diagnostics->Examine 系统弹出
- Spring MVC的测试
测试是保证软件质量的关键. 与 Spring MVC 相关的测试,主要涉及控制器的测试. 为了测试Web项目通常不需要启动项目,需要一些Servlet相关的一些模拟对象,比如MockMVC.MockH ...
- c#中反射技术在Unity中的运用
反射技术给类赋值的好处就是可以简化代码,封装的好处就显而易见了.最直接的用途就是用在在显示配置文件的时候,个人习惯性做法是做一个VO来存储需要的数据,其代码如下: internal class Bas ...
- VS功能扩展--扩展介绍
使用Eclipse的朋友都知道Eclipse是一个完全可扩展的IDE,那么在windows程序开发时,我们常使用的IDE(Visual studio)是否具有功能的扩展性呢?毫无疑问,回答是肯定的.我 ...