php8.5
Home/ Manual/ yaf / yaf_dispatcher/ Yaf_Dispatcher::getDefaultController

Yaf_Dispatcher::getDefaultController

PHP function Edit on GitHub ✎

(Yaf >=3.2.0)

Retrieve the default controller name

Description

Yaf_Dispatcher::getDefaultController(): string|null

Get the default controller name, which is used when a controller name can not be extracted from the request URI. Defaults to "Index".

Parameters Parameters

Return Values

The default controller name, or null if the application is not initialized.

Examples

Yaf_Dispatcher::getDefaultController example

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

var_dump(Yaf_Dispatcher::getInstance()->getDefaultController());
?>

The above example will output something similar to:

output
string(5) "Index"

See Also

  • Yaf_Dispatcher::setDefaultController

Source: reference/yaf/yaf_dispatcher/getdefaultcontroller.xml · from the official PHP manual (php/doc-en)