php 5 constructor _construct does not work

后端 未结 2 1039
借酒劲吻你
借酒劲吻你 2020-12-12 05:18

We have php 5.3.0 and I would like to use the constructor _construct. But somehow this constructor is not called when an instance of the class is made. And old constructor (

相关标签:
2条回答
  • 2020-12-12 05:34

    __construct() (two underscores)

    Second question: fix the underscores in __construct() and see if this is still a problem.

    0 讨论(0)
  • 2020-12-12 05:37

    Try:

    abstract class Foo {
        function __construct() { } 
    }
    
    class Bar extends Foo{
        function __construct($arg){
            parent::_construct();
        } 
    }
    
    0 讨论(0)
提交回复
热议问题