Zend application.ini

0 Cevap php

I'd prefer to use native php for Zend configuration. How would I convert this Zend application.ini segment into php?

[development : production]

production section supposedly inherits from development section. P.S we are talking about ZEND framework here.

Ben sorumu net değilmiş gibi Update: görünüyor.

Ben bilmek istedim Tüm Zend_Application ini veya xml karşılaştırarak php seçenekleri dosyası yuvalama / devralma nasıl işleyeceğini oldu.

INI config example (everything in production section will be inherited by testing and development section):

[production]
autoloaderNamespaces[] = "My_"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"

[testing : production]
bootstrap.class = "productionBootstrap"

[development : production]
bootstrap.class = "developmentBootstrap"

XML config example (everything in production section will be inherited by staging section, note extends keyword):

<?xml version="1.0"?>
<configdata>
    <production>
        <webhost>www.example.com</webhost>
        <database>
            <adapter>pdo_mysql</adapter>
            <params>
                <host>db.example.com</host>
                <username>dbuser</username>
                <password>secret</password>
                <dbname>dbname</dbname>
            </params>
        </database>
    </production>
    <staging extends="production">
        <database>
            <params>
                <host>dev.example.com</host>
                <username>devuser</username>
                <password>devsecret</password>
            </params>
        </database>
    </staging>
</configdata>

PHP config example No inheritance/nesting? Is there a way to make inheritance/nesting work without doing manual array merging?

return array(
    'production' => array(
         $test1 => 'aaaaaaa'
     ),
    'staging' => array(
        $test2 => 'bbbbbb'
    ),
    'testing' => array(
        $test3 => 'bbbbbb'
    )

)

UPDATE

In retrospect - just wanted to add that there are certain advantages to using php arrays instead of ini files for configuration: some info

· Onlar bir opcode önbellek tarafından önbelleğe alınabilir

· Onlar sabitleri destek

· Kolayca okunabilir yapılandırma ağaçları oluşturmak için izin

· Onlar boolean ve tamsayı değerleri destekleyecek

0 Cevap