首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Yaf_Bootstrap_Abstract (class)

介绍

(没有可用的版本信息,可能只在Git中)

Bootstrap是一种用于在运行应用程序之前做一些初始配置的机制。

用户可以通过继承Yaf_Bootstrap_Abstract来定义自己的Bootstrap类

任何在Bootstrap类中用前导“_init”声明的方法,都会根据Yaf_Application::bootstrap()按照它们的定义顺序逐个调用。

示例

示例#1 Bootstrap示例

代码语言:javascript
复制
<?php
   /* bootstrap class should be defined under ./application/Bootstrap.php */
   class Bootstrap extends Yaf_Bootstrap_Abstract {
        public function _initConfig(Yaf_Dispatcher $dispatcher) {
            var_dump(__METHOD__);
        }
        public function _initPlugin(Yaf_Dispatcher $dispatcher) {
            var_dump(__METHOD__);
        }
   }

   $config = array(
       "application" => array(
           "directory" => dirname(__FILE__) . "/application/",
       ),
   );
 
   $app = new Yaf_Application($config);
   $app->bootstrap();
?>

上面的例子会输出类似于:

代码语言:javascript
复制
string(22) "Bootstrap::_initConfig"
string(22) "Bootstrap::_initPlugin"

类别简介

abstract Yaf_Bootstrap_Abstract {

/* Properties */

/* Methods */

}

← Yaf_Application::__wakeup

Yaf_Dispatcher →

扫码关注腾讯云开发者

领取腾讯云代金券