我收到的错误是 注意:未定义索引:登录C:\ xampp \ htdocs \ hindustane \ includes \ top-header.php第19行 我的top-header.php文件如下所述:
<div class="top-banner-container">
<a class="routine-banner-link" href="#"> </a>
</div>
<div class="container-fluid top-lighthouse">
<nav class="navbar navbar-default">
<div class="container top-lighthouse-container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand visible-xs" href="#">Menu</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<?php if(strlen($_SESSION['login']))
{ ?>
<li><a href="#"><i class="icon fa fa-user"></i>Welcome -<?php echo htmlentities($_SESSION['username']);?></a></li>
<?php } ?>
<li class="navbar-border"><a class="text-muted navbar-position" href="#">Buyer Protection</a></li>
<li class="dropdown navbar-border">
<a href="#" class="navbar-position text-muted dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Help <span class="glyphicon glyphicon-menu-down"></span></a>
<ul class="dropdown-menu">
<li><a class="text-muted navbar-position" href="#">Customer Service</a></li>
<li><a class="text-muted navbar-position" href="#">Disputes & Reports</a></li>
</ul>
</li>
<li class="navbar-border"><a class="text-muted navbar-position" href="#">Mobile</a></li>
<li class="dropdown navbar-border">
<a href="#" class="text-muted dropdown-toggle navbar-position" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Ship to <span class="glyphicon glyphicon-globe"></span> / USD<span class="glyphicon glyphicon-menu-down"></span></a>
<ul class="dropdown-menu">
<li><a class="text-muted navbar-position" href="#">Customer Service</a></li>
<li><a class="text-muted navbar-position" href="#">Disputes & Reports</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="text-muted dropdown-toggle navbar-position" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Language<span class="glyphicon glyphicon-menu-down"></span></a>
<ul class="dropdown-menu">
<li><a class="text-muted navbar-position" href="#">Customer Service</a></li>
<li><a class="text-muted navbar-position" href="#">Disputes & Reports</a></li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container-fluid -->
</nav>
</div>
我无法解决它,需要帮助
答案 0 :(得分:1)
PHP: "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset"
可能重复但是在你的情况下你可以解决你的错误,如下面的错误或者像error_reporting(error_reporting()&amp; ~E_NOTICE)一样。
<?php if(isset($_SESSION['login']) && !empty($_SESSION['login'])){ ?>
答案 1 :(得分:0)
if(strlen($_SESSION['login']))
需要替换为
if(isset($_SESSION['login']))