PHP 8.6.0 Beta 3 is available for testing

Yaf_Controller_Abstract::__construct

(Yaf >=1.0.0)

Yaf_Controller_Abstract::__constructConstructor of Yaf_Controller_Abstract

Beschreibung

public function Yaf_Controller_Abstract::__construct()

Yaf_Controller_Abstract::__construct() is called by Yaf when a controller object is created during dispatching. It takes no arguments, and users should not call it directly. Since it is not intended to be overridden with custom logic, Yaf_Controller_Abstract::init() is provided as the userland initialization hook instead.

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

No value is returned.

Beispiele

Beispiel #1 Yaf_Controller_Abstract::__construct() example

<?php
class IndexController extends Yaf_Controller_Abstract
{
    // __construct() is called by Yaf_Dispatcher when the controller
    // is instantiated during dispatching, and should be neither
    // called manually nor overridden. Define init() instead:

    public function init() {
        // by the time init() runs, the dispatcher has already wired
        // up the controller: the request, response and view engine
        // are all available
        var_dump($this->getRequest() instanceof Yaf_Request_Abstract);
        var_dump($this->getResponse() instanceof Yaf_Response_Abstract);
        var_dump($this->getView() instanceof Yaf_View_Interface);
    }

    public function indexAction() {
        // ...
    }
}
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

bool(true)
bool(true)
bool(true)

Siehe auch

add a note

User Contributed Notes

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