PHP MVC-在_构造中返回调用_user_func_array()

PHP MVC-在_构造中返回调用_user_func_array(),php,Php,我在一个MVC网站上工作,但我有一个问题。我无法从控制器返回任何内容。我可以做类似于$this->someMethod()的事情,但不能返回“hello”我认为这与调用用户函数数组()有关,那么我该如何解决这个问题呢 我的代码: 路由器: Class App { protected $controller = 'home'; protected $method = 'index'; protected $parameters = []; public function __construct

我在一个MVC网站上工作,但我有一个问题。我无法从控制器返回任何内容。我可以做类似于
$this->someMethod()
的事情,但不能
返回“hello”
我认为这与
调用用户函数数组()有关,那么我该如何解决这个问题呢

我的代码: 路由器:

Class App
{

protected $controller = 'home';
protected $method = 'index';
protected $parameters = [];

public function __construct()
{
    $url = $this->Url();

    if(file_exists('../app/controllers/'. $url[0] .'.php')){

        $this->controller = $url[0];
        unset($url[0]);
    }

    require_once '../app/controllers/'. $this->controller .'.php';

    $this->controller = new $this->controller;

    if (isset($url[1])){
        if (method_exists($this->controller, $url[1])){
            $this->method = $url[1];
            unset($url[1]);
        }
    }

    $this->parameters = $url ? array_values($url) : [''];

    call_user_func_array([$this->controller, $this->method], $this->parameters);

}

public function Url()
{
    if(isset($_GET['url'])){
        $url = filter_var(rtrim($_GET['url'], '/'), FILTER_SANITIZE_URL);
        $exploded_url = explode('/', $url);
        return $exploded_url;
    }
}
}
Public Index.php:

<?php

    require_once '../app/core/init.php';

    $app = new App;

那么我该如何解决这个问题,使
返回
也能正常工作?

您使用的是哪种框架???请不要用
我自己的框架
回应@哈克曼:这是Luuk777w框架。我想你已经有了回答自己问题所需的所有代码。您的Router类调用call_user_func_数组,这是返回值的地方。如果你想对返回值做些什么,那就是地方。你确定你的意思是“返回”一个值吗?或者你的意思是输出一个值?你打算在哪里使用返回的值???@Hackerman Its用于一个学校项目,他们不允许在这个项目中使用框架。所以我必须自己做
class Home extends Controller
{
public function index($name)
{
    //this works.
    $this->view('index');
    
    //this does not work.
    
    return "hello";

    }
}