0
回答
一个应用中多个库的,配置文件是单独设置还是用一个配置文件比较好?
利用AWS快速构建适用于生产的无服务器应用程序,免费试用12个月>>>   

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

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

比如 


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
                )

        )

)

举报
yak
发帖于6年前 0回/73阅
顶部