php 5 constructor _construct does not work

后端 未结 2 1045
借酒劲吻你
借酒劲吻你 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:37

    Try:

    abstract class Foo {
        function __construct() { } 
    }
    
    class Bar extends Foo{
        function __construct($arg){
            parent::_construct();
        } 
    }
    

提交回复
热议问题