我无法将2个会话与“或”进行比较

时间:2019-06-16 13:47:14

标签: php

如果名称相同,则输出=“ Please in in”,否则,输出=“ get out”

我将笔记本电脑与php7和xammp v3.2.2一起使用

<?php

session_start();

$_SESSION['name'] ="steven";

//this the problem
if($_SESSION['name']!="andy" or $_SESSION['name']!="steven"){
echo "get out";
}
else{
    echo "Please come in";
}
//I tried replacing or with || , but the results are the same

/*
//this code can produce the correct results

if($_SESSION['name']!="andy"){
    if($_SESSION['name']!="steven"){
        echo "get out";
    }
    else{
        echo "Please come in";  
    }
}
*/
session_destroy();
?>

我希望输出“请进来”,但实际输出是“滚出”

0 个答案:

没有答案