Yaf_Dispatcher::registerPlugin

(Yaf >=1.0.0)

Yaf_Dispatcher::registerPlugin注册插件

说明

public function Yaf_Dispatcher::registerPlugin(Yaf_Plugin_Abstract $plugin): Yaf_Dispatcher

注册插件(参见 Yaf_Plugin_Abstract)。通常在 Bootstrap 中注册插件(参见 Yaf_Bootstrap_Abstract)。

参数

plugin

返回值

示例

示例 #1 Yaf_Dispatcher::registerPlugin() 示例

<?php
class Bootstrap extends Yaf_Bootstrap_Abstract {
  public function _initPlugin(Yaf_Dispatcher $dispatcher) {
    /**
    * Yaf assumes plugin scripts under [application.directory] .  "/plugins" 
    * for this case, it will be:
    * [application.directory] . "/plugins/" . "User" . [application.ext]
    */ 
    $user = new UserPlugin();
    $dispatcher->registerPlugin($user);
  }
}
?>
添加备注

用户贡献的备注

此页面尚无用户贡献的备注。
To Top