Is there a use-case for singletons with database access in PHP?

后端 未结 11 1823
名媛妹妹
名媛妹妹 2020-11-21 06:44

I access my MySQL database via PDO. I\'m setting up access to the database, and my first attempt was to use the following:

The first thing I thought of is glob

11条回答
  •  再見小時候
    2020-11-21 07:43

    You are not missing anything, as far as I can see. The example is pretty flawed. It would make difference, if the singleton class had some non-static instance variables.

提交回复
热议问题