0
回答
一个应用中多个库的,配置文件是单独设置还是用一个配置文件比较好?
百度AI开发者大赛带你边学边开发,赢100万奖金,加群:418589053   

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

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

比如 


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回/77阅
顶部