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

继承父类的时候 _construct报异常

WBOY
Release: 2016-06-13 13:25:16
Original
869 people have browsed it

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


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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template