简体   繁体   中英

ZF2 application autoload files

I've been experimenting with integrating ZF2 with Doctrine 2 using SpiffyDoctrine libraries.

The docs suggest dropping a module.spiffy_doctrine_orm.config.php into config/autoload for the Application. However when I do this I am getting an error:

Warning: Cannot modify header information - headers already sent by (output started at ~/zf2tutorial-doc/config/autoload/module.spiffy_doctrine_orm.config.php:1) in ~/zf2/library/Zend/Http/PhpEnvironment/Response.php on line 40

However if I removed this file and drop the contents of it into either the local.config.php (which seems a good place for database login details) or global.config.php then there isn't a problem.

My question is, why this is so? I can't find anything is the ZF2 docs that explains this autoload folder other than all files are auto run.

This looks like some random characters have made it before that <?php . You might check escaped characters (eg UTF8-specific ones) as well.

The folder itself is thought of as a place for application specific configuration while the other config files within the module folders are for module specific configuration. So modules provide a configuration which you can overwrite in that folder for application specific needs.

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