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";
}
?>
出力:localhostの/ myDirに/ index.phpを/ ABC/DEF
通知:未定義のインデックス:コントローラ/srv/http/myDir/bootstrap.php o n個のライン8
お知らせ:未定義のインデックス:ライン上の/srv/http/myDir/bootstrap.phpでアクション14
0用true
なりますempty()
ホーム
インデックス
[参照の可能性の重複 - このエラーはどういう意味:
isset($this->request['action'])
isset($this->request['controller'])
このようにPHPで?](http://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) –