一个应用中多个库的,配置文件是单独设置还是用一个配置文件比较好?

yak 发布于 2012/04/26 10:09
阅读 78
收藏 0

如果一个库一个配置文件,比如一个业务要操作两个库,就比较麻烦

如果合用一个配置文件,好象格式比较复杂,如果再加个主从配置+分库,这个格式就有点复杂了 

比如 


Array
(
    [db1_master] => Array
        (
            [username] => xxx
            [password] => xxx
        )

    [db1_slave] => Array
        (
            [username] => xxx
            [password] => xxx
        )

    [db2_master] => Array
        (
            [username] => xxx
            [password] => xxx
        )

    [db2_slave] => Array
        (
            [username] => xxx
            [password] => xxx
        )

)

或者

Array
(
    [db1] => Array
        (
            [master] => Array
                (
                    [user] => xxx
                    [password] => xxx
                )

            [slave] => Array
                (
                    [user] => xxx
                    [password] => xxx
                )

        )

    [db2] => Array
        (
            [master] => Array
                (
                    [user] => xxx
                    [password] => xxx
                )

            [slave] => Array
                (
                    [user] => xxx
                    [password] => xxx
                )

        )

)

加载中
返回顶部
顶部