简体   繁体   中英

How to register new module in zend framework 2

I want to make my own module in zend framework2, I have tried this below code as per the doc. mentioned

return array(
    'modules' => array(
        'Application',
        'Album',
        'Photo',
    'SanAuth',
    'Newmodule',  // <- here is my newly added module name
    ),
    'module_listener_options' => array(
        'config_glob_paths'    => array(
            'config/autoload/{,*.}{global,local}.php',
        ),
        'module_paths' => array(
            './module',
            './vendor',
        ),
    ),
);

But when I add this only one line code! my all working module gives blank result even which are working fine started giving blank result! How can I come out from this ?

What you did is enabling the Module. You should have created it first. Take a look here . And you can use ZFTool for module managing (it saves you from the dull process).

It's normal to see a blank screen. There is an Exception being thrown which is probably saying that your module doesn't exist or something like that. Make sure you set display_errors = On in your php.ini, so you can debug in an easier manner.

All you have done it tell Zend to start looking for a new module, but you have yet to create the module.

to create the module you need to add a folder with the same name under the ./module folder.

namespace ModuleName;

Class Module {

}

which is the minimum a module needs to load.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM