无法访问数组PHP 7.4

我用PHP 7.4访问数组时遇到问题。有没有人解决?

码:

public function __construct()
    {

        $url = $this->parseUrl();
        print $url;

        if($url[0] == "user") {
            $this->controller = $url[0];
            unset($url[0]);
            require_once './controller/user/Login.php';
        }

    }

    public function parseUrl()
    {
        if (isset($_GET['url'])) {
            return $url = explode('/', filter_var(rtrim($_GET['url'], '/'), FILTER_SANITIZE_URL));
        }
    }
Notice: Trying to access array offset on value of type null in /Users/marvinfritz/Documents/Projekte/web/aladin/app/core/App.php on line 15

请帮忙! :)

马文

评论