PHP 8.6.0 Beta 3 is available for testing

Yaf_Dispatcher::setDefaultController

(Yaf >=1.0.0)

Yaf_Dispatcher::setDefaultControllerChange default controller name

Опис

public function Yaf_Dispatcher::setDefaultController(string $controller): Yaf_Dispatcher|null|false

Change the controller name which is used when a controller name can not be extracted from the request URI. The name is normalized to capitalize the first letter.

Параметри

controller

The name of the controller.

Значення, що повертаються

Returns the Yaf_Dispatcher object itself on success, or false if the application is not initialized.

Приклади

Приклад #1 Yaf_Dispatcher::setDefaultController() example

<?php
$app = new Yaf_Application(dirname(__FILE__) . "/conf/application.ini");

// Requests without a controller part now go to HomeController, the name
// is normalized to capitalize the first letter
Yaf_Dispatcher::getInstance()->setDefaultController("home");

$app->run();
?>

Прогляньте також

add a note

User Contributed Notes

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