我正在本地主机上运行我的项目,并在更新我的xampp后收到此错误。以前一切都很好。
通知:未定义索引:第4行E:\ Xammpp \ htdocs \ trms \ index.php中的页面 通知:未定义索引:记住第5行的E:\ Xammpp \ htdocs \ trms \ index.php 无法连接数据库
<?php
include_once 'include/processes.php';
$Login_Process = new Login_Process;
$Login_Process->check_login($_GET['page']);
$Login = $Login_Process->log_in($_POST['user'], $_POST['pass'], $_POST['remember'], $_POST['page'], $_POST['submit']);
include_once 'templates/header.php';
?>
数据库文件代码
<?php
#Database Information
//Database Server (localhost)
//define("DBHOST","213.171.200.57");
define("DBHOST","127.0.0.1");
//define("DBHOST”,”localhost”);
//Database Username
define("DBUSER", "root");
//Database Password
define("DBPASS","");
//Database Name
define("DBNAME","tsurphu_db");
//Database Tabel
define("STAFF","users");
define("TSURPHU","tsurphus");
define("KUNKYONGD","kunkyong_domestic");
define("KUNKYONGF","kunkyong_foreign");
//define("DONATION","donations");
define("CURRENCY","currencies");
//define("PAYMENT","payments");
//Location Information
//Path of script with trailing slashes
define("Script_Path","/trms/");
// Path in your webfiles with directory name uploads
define("Upload_Path","../uploads/");
//URL of script (no trailing slash)
define("Script_URL","http://localhost/trms");
答案 0 :(得分:1)
如果您使用的是PHP 7.x,请使用null coalescing operator检查$_GET['page']
:
$page = $_GET['page'] ?? '';
如果存在并且不为NULL,则返回其第一个操作数;除此以外 它返回它的第二个操作数。
对于较早的PHP版本:
$page = isset($_GET['page']) ? $_GET['page'] : '';
<?php
include_once 'include/processes.php';
$page = $_GET['page'] ?? ''; // this is equivalent to $page = isset($_GET['page']) ? $_GET['page'] : '';
$Login_Process = new Login_Process;
$Login_Process->check_login($page);
$Login = $Login_Process->log_in($_POST['user'], $_POST['pass'], $_POST['remember'], $_POST['page'], $_POST['submit']);
include_once 'templates/header.php';
?>