Dutch PHP Conference 2027

Yaf_Dispatcher::__construct

(Yaf >=1.0.0)

Yaf_Dispatcher::__constructYaf_Dispatcher constructor

Опис

private function Yaf_Dispatcher::__construct()

Yaf_Dispatcher implements the singleton pattern, so the constructor is private. Use Yaf_Dispatcher::getInstance() to retrieve the dispatcher instance, which is created by Yaf_Application.

Параметри

У цієї функції немає параметрів.

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

Не повертає значень.

Приклади

Приклад #1 Yaf_Dispatcher is a singleton

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

// Yaf_Dispatcher implements the singleton pattern, so its constructor is
// private. Retrieve the instance with Yaf_Dispatcher::getInstance()
// instead of calling `new`.
$dispatcher = Yaf_Dispatcher::getInstance();

var_dump($dispatcher instanceof Yaf_Dispatcher);
?>

Поданий вище приклад виведе щось схоже на:

bool(true)

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

add a note

User Contributed Notes

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