svn: /phpdoc/en/trunk/reference/yaf/yaf_route_regex/ construct.xml

From: Date: Tue, 05 Jul 2016 07:03:59 +0000
Subject: svn: /phpdoc/en/trunk/reference/yaf/yaf_route_regex/ construct.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-14283@lists.php.net to get a copy of this message
laruence Tue, 05 Jul 2016 07:03:59 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=339562 Log: add example of named capture group Changed paths: U phpdoc/en/trunk/reference/yaf/yaf_route_regex/construct.xml Modified: phpdoc/en/trunk/reference/yaf/yaf_route_regex/construct.xml =================================================================== --- phpdoc/en/trunk/reference/yaf/yaf_route_regex/construct.xml 2016-07-04 22:38:23 UTC (rev 339561) +++ phpdoc/en/trunk/reference/yaf/yaf_route_regex/construct.xml 2016-07-05 07:03:59 UTC (rev 339562) @@ -140,6 +140,30 @@ </programlisting> </example> <example> + <title><function>Yaf_Route_Regex and named capture ground(as of 2.3.0)</function>example</title> + <programlisting role="php"> +<![CDATA[ +<?php + /** + * Use match result as MVC name + */ + Yaf_Dispatcher::getInstance()->getRouter()->addRoute("name", + new Yaf_Route_Regex( + "#^/product/(?<name>[^/]+)/([^/])+#i", //match request uri leading "/product" + array( + 'controller' => ":name", // route to :name, + // which is named capture group 'name' in the match result as controller name + ), + array( + 2 => "id", // to get the first captrue in the match pattern. + ) + ) + ); +?> +]]> + </programlisting> + </example> + <example> <title><function>Yaf_Route_Regex</function>example</title> <programlisting role="php"> <![CDATA[

« previous php.doc.cvs (#14283) next »