当前位置: 代码迷 >> PHP >> 继承父类的时候 _construct报异常
  详细解决方案

继承父类的时候 _construct报异常

热度:48   发布时间:2016-04-29 00:39:15.0
继承父类的时候 __construct报错误。
php, __construct, post
继承父类的时候 __construct报错误。
w
class a{
  function __construct(){
  $this->post();
  }

  function post(){
  //$_POST
  }
}

子类b.php
class b extends a{

  //默认父类__construct()

  functoin index(){
  //
  }
}

问题,在用get浏览b.php文件时,能正常浏览,用post提交数据时,报错,
post数据,在注册父类的__construct,或者复写子类的__construct后就正常。。


------解决方案--------------------
汗... 那还不结贴?