php shared db connection ( design pattern help )
问题 I have a small php app that I want to build a layer of db abstraction on top of with a few "model" type classes. I'm using ezSQL_mysql to do the db work. My question is what is the best way to design the app? Should I use a singleton pattern to share the db connection? Should my "model" classes extend ezSQL_mysql ? Or maybe I'm totally off base here and need to do something else. What I need is something like this Controller.php $db = new ezSQL_mysql($db_user, $db_passwd, $db_database, $db