<?php
namespace Home\Controller;
use Think\Controller;
class PublicController extends Controller{
// ERROR:Call to a member function display() on a non-object
public function __construct(){
}
public function index(){
$this->display();
}
}为什么在继承了Controller的控制器中,添加了一个构造函数,就会发生错误呢?如果我在构造函数中添加一行代码为parent::__construct();那么程序又正常了,有哪位可以帮我解释一下原因吗?谢谢啦 最佳答案