以下是我的代码
<?php
//Vars
$alreadylogged = 0;
$username = 0;
//End Var
//Start Script
print 'Welcome to CraftedList!</br>'
if ($alreadylogged=="1") *Side note, this line is line 34*
{
print 'You are currently logged in as'. $username .'!';
}
else
{
print 'You are not logged in!'
}
?>
Run Code Online (Sandbox Code Playgroud)
但是当我在localhost XAMPP客户端上执行它时,它会返回此错误.
解析错误:语法错误,第34行的C:\ xampp\htdocs\phptest\index.php中的意外'if'(T_IF)
我检查了W3学校,我的代码与他们的代码类似.
你错过了一个 ;
print 'Welcome to CraftedList!</br>';
^ here
Run Code Online (Sandbox Code Playgroud)