使用输出缓冲区时意外的$end


unexpected $end when using output buffer

我在php中有一个奇怪的输出缓冲问题。使用这段代码,在尝试请求第一个文件后,我得到了一个意外的$end错误。(在本例中是/header.php)下面是我的代码设置:

class View
{
    function __construct()
    {
        ob_start();
            $this->page();
        ob_end_flush();
    }
    private function rekwire($filename)
    {           
        if(file_exists(APPPATH.$filename)) require(APPPATH.$filename);
        else if(file_exists(BASEPATH.$filename)) require(BASEPATH.$filename);
    }
    private function page()
    {
        $this->rekwire('/header.php');
        $this->rekwire('/page.php');
        $this->rekwire('/footer.php');
    }
}

这个结构在我的网站主机上为我工作。我最近在设置本地测试服务器(WAMP)时才遇到这个问题,这让我认为它可能是php或apache的设置。任何帮助都是感激的!

对象构造函数无效:-

__construct()

应该是:

function __construct()
public function __construct() // public scope

我的php配置设置short_open_tags没有启用,头文件正在使用echo快捷方式

很抱歉,如果这浪费了你的时间:)