What are Zend Framework “Resources”?

前端 未结 2 1333
南旧
南旧 2021-01-20 23:22

I know this is quite silly to ask, I oftentimes see this term on the documentation but I still don\'t get enlightened by such contexts I encounter. What is the difference betwee

2条回答
  •  情歌与酒
    2021-01-20 23:40

    Simply, a resource is a logical entity which can be used to load & run a zend framework application and used as supply/reserve/store for the application. some resource are loaded automatically by zend framework itself and some you have to or for some resources you just provide configurations.

    In Zend Framework, resource term used in the context of zf application to denote the followings like:
    - cachemanager
    - db
    - multidb
    - frontController
    - layout
    - locale
    - log
    - mail
    - modules
    - navigation
    - router
    - session
    - translate adapter resource
    - useragent
    - view etc.

    Syntax: Zend_Application_Resource_ResourceName

    Sample resource loading description:

    Zend_Application_Resource_Modules

    Zend_Application_Resource_Modules is used to initialize your application modules. If your module has a Bootstrap.php file in its root, and it contains a class named _Module_Bootstrap_ (where "Module" is the module name), then it will use that class to bootstrap the module.

    By default, an instance of _Zend_Application_Module_Autoloader_ will be created for the module, using the module name and directory to initialize it.

    Since the Modules resource does not take any arguments by default, in order to enable it via configuration, you need to create it as an empty array. In INI(application.ini) style configuration, this looks like:

      resources.modules[] =
    

    In XML style configuration, this looks like:

      
    
          
    
              
    
              
    
          
    
      
    

    Using a standard PHP array, simply create it as an empty array:

      $options = array(
    
          'resources' => array(
    
              'modules' => array(),
    
          ),
    
      );
    

    can check out More Here

提交回复
热议问题