Sharing objects between PHP classes

前端 未结 5 1730
予麋鹿
予麋鹿 2020-12-21 04:17

What is the best way to share objects between other classes?

For example; a \"database\" object with functions that are required by the \"article\" and \"user\" obje

5条回答
  •  感情败类
    2020-12-21 04:49

    You could also use objects that have been loaded in session or in cache (APC,memcached) before. Personnaly i think singleton is the best way to go there (especially for database class)

提交回复
热议问题