Recommended way for passing data connection to a PHP class / method?
问题 As of right now I have a database connection string included at the top of each of my pages. I'm then passing my database connection to the methods in my class like this: public function select($db) { //Code here } Code on page: $login_user->select($db); My thought is that if I ever want to query a different database I can just create a new connection string in my include file called $db2 and then I just pass that value instead of $db. Is this a standard way of doing this or do you have a