企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# Class Phalcon\\Mvc\\Micro\\Collection # Class **Phalcon\\Mvc\\Micro\\Collection** *implements*[*Phalcon\\Mvc\\Micro\\CollectionInterface*](#) Groups Micro-Mvc handlers as controllers ``` <pre class="calibre14">``` <?php $app = new \Phalcon\Mvc\Micro(); $collection = new Collection(); $collection->setHandler(new PostsController()); $collection->get('/posts/edit/{id}', 'edit'); $app->mount($collection); ``` ``` ### Methods protected **\_addMap** (*string|array* $method, *string* $routePattern, *mixed* $handler, *string* $name) Internal function to add a handler to the group public **setPrefix** (*unknown* $prefix) Sets a prefix for all routes added to the collection public **getPrefix** () Returns the collection prefix if any public *array***getHandlers** () Returns the registered handlers public <a class="calibre6 pcalibre1" href="">*Phalcon\\Mvc\\Micro\\Collection*</a>**setHandler** (*mixed* $handler, \[*boolean* $lazy\]) Sets the main handler public **setLazy** (*unknown* $lazy) Sets if the main handler must be lazy loaded public **isLazy** () Returns if the main handler must be lazy loaded public *mixed***getHandler** () Returns the main handler public <a class="calibre6 pcalibre1" href="">*Phalcon\\Mvc\\Micro\\Collection*</a>**map** (*string* $routePattern, *callable* $handler, \[*string* $name\]) Maps a route to a handler public <a class="calibre6 pcalibre1" href="">*Phalcon\\Mvc\\Micro\\Collection*</a>**get** (*string* $routePattern, *callable* $handler, \[*string* $name\]) Maps a route to a handler that only matches if the HTTP method is GET public <a class="calibre6 pcalibre1" href="">*Phalcon\\Mvc\\Micro\\Collection*</a>**post** (*string* $routePattern, *callable* $handler, \[*string* $name\]) Maps a route to a handler that only matches if the HTTP method is POST public <a class="calibre6 pcalibre1" href="">*Phalcon\\Mvc\\Micro\\Collection*</a>**put** (*string* $routePattern, *callable* $handler, \[*string* $name\]) Maps a route to a handler that only matches if the HTTP method is PUT public <a class="calibre6 pcalibre1" href="">*Phalcon\\Mvc\\Micro\\Collection*</a>**patch** (*string* $routePattern, *callable* $handler, \[*string* $name\]) Maps a route to a handler that only matches if the HTTP method is PATCH public <a class="calibre6 pcalibre1" href="">*Phalcon\\Mvc\\Micro\\Collection*</a>**head** (*string* $routePattern, *callable* $handler, \[*string* $name\]) Maps a route to a handler that only matches if the HTTP method is HEAD public <a class="calibre6 pcalibre1" href="">*Phalcon\\Mvc\\Micro\\Collection*</a>**delete** (*string* $routePattern, *callable* $handler, \[*string* $name\]) Maps a route to a handler that only matches if the HTTP method is DELETE public <a class="calibre6 pcalibre1" href="">*Phalcon\\Mvc\\Micro\\Collection*</a>**options** (*string* $routePattern, *callable* $handler, \[*unknown* $name\]) Maps a route to a handler that only matches if the HTTP method is OPTIONS | - [索引](# "总目录") - [下一页](# "Class Phalcon\Mvc\Micro\Exception") | - [上一页](# "Class Phalcon\Mvc\Micro") | - [API Indice](#) »