问答详情
源自:2-5 PHP类和对象之构造函数和析构函数

为什么提示运行成功,输出错误

<?php

class Car{

    function _construct(){

        print "构造函数";

    }

    function _destruct(){

        print "析构函数";

    }

}

class Bus extends Car{

    function _construct(){

        print "子类构造";

        parent::_construct();

    }

}

$car =new Car();

$bus =new Bus();


提问者:lyyylll 2018-11-24 16:59

个回答

  • cnsql
    2018-12-18 20:09:27

    因为你的代码并没有跟课程设定的去走所以才会输出错误

  • 慕九州9431754
    2018-11-26 19:42:34

    我试了一下,并没有错误