开发者

PHP Parse error: parse error, expecting `','' or `')'' ...what to do?

<?php //login_success.php

session_start();

if(isset($_SESSION['username'] = $myusername)){
header("location:main_login.php");
}
?>

&开发者_Go百科lt;html>
<body>
Login Successful
</body>
</html>

On runnig this I get the error

Parse error: parse error, expecting `','' or `')'' in C:\wamp\www\a\l\login_success.php on line 4

Can someone help me out with this one, ?


isset($_SESSION['username']) && ($_SESSION['username'] == $myusername)


I see an error at

isset()

You can either use

isset($_SESSION['username'])

or

if($_SESSION['username'] == $myusername)


You might wanna try to get a value for $_SESSION['username'] outside if statement. Something like this

$_SESSION['username'] = $myusername;

if(isset($_SESSION['username'])){
    header("location:main_login.php");
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜