zoukankan      html  css  js  c++  java
  • 转载zendframework 插件方式

    Zend Framework中,我们经常会根据自己的要求自定义一些插件,一般有三种办法来进行加载:

    1.添加到index.php文件中
    定义前端控制器,注册一个插件

    1 $frontController = Zend_Controller_front::getInstance();
    2 $frontController->registerPlugin(new MyApp_Controller_Plugin_Smarty);

    如:Zend Framework整合Smarty

    2.直接添加在配置文件application/configs/application.ini中

    1 resources.frontController.plugins.smarty = "App_Controller_Plugin_Smarty"

    3.当自定义的插件有参数时,没办法直接写在配置文件中加载,我们可以用第一种方法,这里还介绍一个在Bootstrap.php中加载的方法:

    1 protected function _initAutoloade(){
    2 $auth = Zend_Auth::getInstance();
    3 $acl new App_LwAcl();
    4 Zend_Controller_Front::getInstance()->registerPlugin(new App_Controller_Plugin_LwAuth($auth$acl));
    5 }
  • 相关阅读:
    Tyvj 1729 文艺平衡树
    送花
    Tyvj 1728 普通平衡树
    [NOI2004]郁闷的出纳员
    [HNOI2004]宠物收养所
    [HNOI2002]营业额统计
    [NOIP2012] 借教室
    无聊的数列
    忠诚
    XOR的艺术
  • 原文地址:https://www.cnblogs.com/phplover/p/3026917.html
Copyright © 2011-2022 走看看