日期:2014-05-16  浏览次数:20423 次

PHP之设计模式—建造者模式(通过选择mysql,mongo数据库链接类型做说明)

1、什么是建造者模式?

      建造者设计模式定义了处理其他对象的复杂构建的对象设计。

2、用一个简单的mysql,mongo链接类说明:




测试输出结果:

Array ( [0] => 1 [bid] => 1 [1] => 9 [uid] => 9 [2] => 0 [like] => 0 [3] => [type] => [4] => 0 [local] => 0 [5] => 0 [date] => 0 [6] => 0 [extra1] => 0 [7] => 0 [extra2] => 0 [8] => 0 [extra3] => 0 [9] => 0 [extra4] => 0 [10] => 0.00 [extra5] => 0.00 [11] => 0.00 [extra6] => 0.00 [12] => 0.00 [extra7] => 0.00 [13] => 0.00 [extra8] => 0.00 )


PS:由于我的ubuntu服务器没有装MongoDB,所有没有测试mongodb。有安