Yaf_Controller_Abstract::__construct
PHP Manual
PHP Manual»Yaf_Controller_Abstract»Yaf_Controller_Abstract::__construct

Yaf_Controller_Abstract::__construct

(Yaf >=1.0.0)

Yaf_Controller_Abstract::__construct — Constructor of Yaf_Controller_Abstract

Açıklama

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.

Bağımsız Değişkenler

Bu işlevin bağımsız değişkeni yoktur.

Dönen Değerler

No value is returned.

Örnekler

Örnek 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() {
        // ...
    }
}
?>

Yukarıdaki örnek şuna benzer bir çıktı üretir:

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

Ayrıca Bakınız

To Top