Php标头不起作用,标头未发送[关闭]

I'm coding a template engine, herefor i've made a function:

public function getFilename() {
    $config = new Config('template_config.ini');
    if($this->filepath == null){
        $this->filename = $config->get("file")["default"];
    }else{
        if(array_key_exists($this->filepath, $config->get("file"))){
            $this->filename = $config->get("file")[$this->filepath];
        } else {
            Redirect::to("/404");
            return $this;
        }
    }
    return $this;
}

The code ran fine, until it didn't anymore. It runs to the right box and it runs the redirect function that is equal to: header("Location: ".$input); exit;. After the header it echo's out things fine, the header is just not linking through.

This all is called in a index:

use lib\Template\Template_loader;
use lib\Api\Input;
require_once("Nytrix/autoloader.php");
new Template_loader(Input::get("path"));

Then this calls the constructor, this calls the filename function:

public function __construct($filepath){
    $this->filepath = $filepath;
    $this->getFilename();

}

The Redirect::to($argument); function is: header("Location: ".$argument);. No laravel implemented

This code is a little off. Calling Redirect::to("/404"); doesn't set the headers or anything. It generates an Illuminate\Http\RedirectResponse object that needs to be returned from the controller.