Yaf_Application::bootstrap

(Yaf >=1.0.0)

Yaf_Application::bootstrap锟斤拷锟斤拷bootstrap

说锟斤拷

public Yaf_Application::bootstrap ([ Yaf_Bootstrap_Abstract $bootstrap ] ) : void

指示Yaf_Application去寻锟斤拷Bootstrap锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷顺锟斤拷执锟斤拷锟斤拷锟斤拷锟斤拷Bootstrap锟斤拷锟叫讹拷锟斤拷锟斤拷锟絖init锟斤拷头锟侥凤拷锟斤拷锟斤拷 锟斤拷锟矫伙拷锟斤拷峁╋拷锟斤拷锟絙ootstrap锟斤拷Yaf默锟较伙拷去application.directory锟斤拷寻锟斤拷Bootstrap锟斤拷

锟斤拷锟斤拷

bootstrap

A Yaf_Bootstrap_Abstract instance

锟斤拷锟斤拷值

Yaf_Application instance

锟斤拷锟斤拷

Example #1 A Bootstrap()example

<?php
/**
 * This file should be under the APPLICATION_PATH . "/application/"(which was defined in the config passed to Yaf_Application).
 * and named Bootstrap.php,  so the Yaf_Application can find it 
 */
class Bootstrap extends Yaf_Bootstrap_Abstract {
    function 
_initConfig(Yaf_Dispatcher $dispatcher) {
        echo 
"1st called\n";
    }

    function 
_initPlugin($dispatcher) {
        echo 
"2nd called\n";
    }
}
?>

Example #2 Yaf_Application::bootstrap()example

<?php

defined
('APPLICATION_PATH')                  // APPLICATION_PATH will be used in the ini config file
    
|| define('APPLICATION_PATH'__DIR__)); //__DIR__ was introduced after PHP 5.3

$application = new Yaf_Application(APPLICATION_PATH.'/conf/application.ini');
$application->bootstrap();
?>

锟斤拷锟斤拷锟斤拷锟教碉拷锟斤拷锟斤拷锟斤拷锟斤拷冢锟�

1st called
2nd called

锟轿硷拷