Home >Backend Development >PHP Tutorial >继承父类的时候 _construct报异常

继承父类的时候 _construct报异常

WBOY
WBOYOriginal
2016-06-13 10:32:24977browse

继承父类的时候 __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后就正常。。


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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn