本文介紹了注意:未定義變量:“"中的 _SESSION在第 9 行的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
這是我的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>
我知道代碼有問題,但不知道如何修復(fù).我的錯(cuò)誤是:注意:未定義變量:_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"
我該如何修復(fù)錯(cuò)誤,讓它顯示用戶的名字?mySQL 上的數(shù)據(jù)庫表中的第一個(gè)名稱稱為 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
你會(huì)有類似的東西:
<?php session_start();
include("inc/incfiles/header.inc.php")?>
<html>
<head>
<meta http-equiv="Content-Type" conte...
這篇關(guān)于注意:未定義變量:“"中的 _SESSION在第 9 行的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!