我收到PHP通知错误。这段代码在php 5.3中工作正常,但后来我将PHP升级到了PHP 7.我想要做的是从链接中获取URL,并显示URL附带的参数。这是代码。如何解决此PHP通知错误?
的index.php
<?php
require_once('bootstrap.php');
$bootstrap = new Bootstrap($_GET);
?>
bootstrap.php中要去URL
<?php
class Bootstrap{
private $controller;
private $action;
private $request;
public function __construct($request){
$this->request = $request;
if($this->request['controller'] == ''){
$this->controller = "Home";
}
elseif($_GET($request['controller'])){
$this->controller = $this->request['controller'];
}
if($this->request['action'] == ''){
$this->action = "index";
} else{
$this->action = $this->request['action'];
}
echo "<br />$this->controller<br />$this->action";
}
?>
输出:本地主机/ MYDIR/index.php文件/ ABC/DEF
注意:未定义的索引:/srv/http/myDir/bootstrap.php中的控制器N线8
注意:未定义指数:行动/srv/http/myDir/bootstrap.php线14
首页
指数
[符号的可能的复制 - 这个错误是什么意思在PHP?](http://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) –