PHP 8.5.10 Released!

Yaf_Dispatcher::getRouter

(Yaf >=1.0.0)

Yaf_Dispatcher::getRouterRetrieve router instance

Beschreibung

public function Yaf_Dispatcher::getRouter(): ?Yaf_Router

Retrieve the Yaf_Router instance used by the dispatcher to route requests.

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

The Yaf_Router instance, or null if the application is not initialized.

Beispiele

Beispiel #1 Yaf_Dispatcher::getRouter() example

<?php
class Bootstrap extends Yaf_Bootstrap_Abstract
{
    public function _initRoute(Yaf_Dispatcher $dispatcher)
    {
        $router = $dispatcher->getRouter();

        // Route /product/42 to ProductController::detailAction
        $router->addRoute("product", new Yaf_Route_Rewrite(
            "product/:id",
            array("controller" => "product", "action" => "detail")
        ));
    }
}
?>

Siehe auch

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top