本文介紹了注意:未定義變量:“"中的 _SESSION在第 9 行的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
這是我的php代碼:
<?php include("inc/incfiles/header.inc.php")?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Member Index</title>
<link href="css/main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Welcome <?php echo ($_SESSION['SESS_fname']);?></h1>
<a href="member-profile.php">My Profile</a> | <a href="logout.php">Logout</a>
<p>This is a password protected area only accessible to members. </p>
</body>
</html>
我知道代碼有問題,但不知道如何修復.我的錯誤是:注意:未定義變量:_SESSION in C:xampphtdocsSmashermember-index.php 第 9 行"
I know something I wrong with the code but I don't know how to fix it. My error says: "Notice: Undefined variable: _SESSION in C:xampphtdocsSmashermember-index.php on line 9"
我該如何修復錯誤,讓它顯示用戶的名字?mySQL 上的數據庫表中的第一個名稱稱為 fname
.
How can I fix the error so it will say the user's first name? The first name in the database table on mySQL is called fname
.
推薦答案
添加
session_start();
在任何 HTML 之前的頁面開頭
at the beginning of your page before any HTML
你會有類似的東西:
<?php session_start();
include("inc/incfiles/header.inc.php")?>
<html>
<head>
<meta http-equiv="Content-Type" conte...
這篇關于注意:未定義變量:“"中的 _SESSION在第 9 行的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!