用户名在php中不回显

用户名在php中不回显,php,Php,我有代码,每次登录时都会回显用户的用户名。它曾经起过作用,但从那以后就没有起过作用。请帮忙 到目前为止,这里是home.php 下面是标题php代码 试试这个: index.php <?php include("./inc/header.inc.php"); echo "<br><br><br><br>Hello, ".$user; echo "<br>Would you l

我有代码,每次登录时都会回显用户的用户名。它曾经起过作用,但从那以后就没有起过作用。请帮忙 到目前为止,这里是home.php


下面是标题php代码


试试这个: index.php

<?php
include("./inc/header.inc.php");
echo "<br><br><br><br>Hello, ".$user;
echo "<br>Would you like to <a href='logout.php'>Log Out</a>?";

你试过
var\u dump($\u SESSION)
吗?@Steven我把它放在哪里?在
SESSION\u start()之后的任何地方。
@Steven好的,谢谢,我会试试的
<?php
session_start();
$user = $_SESSION['user_login'] ?? 'Undefined User' ;