douxin1884 2015-07-16 15:54
浏览 54
已采纳

PHP 5.6 Singleton?

I just copied singleton template from phptherightway

I use PHP 5.6.3 (cli) And I got this error:

singleton error

Can somebody explain this ?

  • 写回答

1条回答 默认 最新

  • dongwuxie7976 2015-07-16 16:01
    关注

    It's the late static binding against a private property that's causing the problems.

    Either modify the visibility of $instance to protected

    Or modify the references to static::$instance in getInstance() to self::$instance

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?