在php中的html片段上获取错误 [英] Getting errors on html snippets inside of php

查看:66
本文介绍了在php中的html片段上获取错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个会员系统的代码,这行代码检查用户是否已登录显示他/她的名字,但我收到错误。



 <?php  
// 检查是否设置了用户名会话
// 如果已设置,则使用用户名
// 如果不是那么显示登录/注册
如果(!isset($ _ SESSION [' user'])){
echo $ lgrreg;
} else {
echo 嗨$ username!;
}

$ lgout = ' < a href =logout.php> Logout?< / a>';

$ lgrreg = ' < a href =membersys.php>
登入/注册
< / a>'
;
?>





At:

第26行:$ lgrreg ='< a href =membersys.php>



我有一些错误



注意:未定义的变量:lgrreg在C:\ xampp \htdocs \ index.php上线26







但我怎么没定义它?

解决方案

_SESSION [' user']) ){
echo


lgrreg;
} else {
echo 您好


用户名!;
}


So I have my code for a member system and this line of code checks if the user has logged in to display his/her name but I am getting errors.

<?php
		// Check if username session is set or not 
		//if it is set then say Hi with the username
		//If it is not then display login/Register
		if (!isset($_SESSION['user'])) {
			echo "$lgrreg";
		}else{
			echo "Hi $username! ";
		}
			
		$lgout = '<a href="logout.php">Logout?</a>';
			
		$lgrreg = '<a href="membersys.php">
		Login/Register
		</a>';
?>



At :
Line 26: $lgrreg = '<a href="membersys.php">

I have some errors

Notice: Undefined variable: lgrreg in C:\xampp\htdocs\index.php on line 26



But how have I not defined it?

解决方案

_SESSION['user'])) { echo "


lgrreg"; }else{ echo "Hi


username! "; }


这篇关于在php中的html片段上获取错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆