相关疑难解决方法(0)

PHP真实和'真实'的区别

快问.两者之间有区别吗?

$success = true;
Run Code Online (Sandbox Code Playgroud)

$success = 'true';
Run Code Online (Sandbox Code Playgroud)

我知道他们不是==彼此,但使用它们有区别吗?

编辑:我发现在查看$ success是否为false时使用'==='代替'=='解决了我的问题.我现在的问题是,如果我只是在下面的情况下使用字符串,并坚持使用'=='?

    $User->ProcessLogin();
$loginsuccess = $User->ProcessLogin();

if ($loginsuccess == true) {    
    echo "<big>Success<big><br />";
        echo "<p>We are now redirecting you to the member area.</p>";
        echo "<meta http-equiv='refresh' content='=2;MyAccountNEW.php' />";
}
elseif ($loginsuccess == false) {
        echo "<span class='sorry'><b>Sorry, your account could not be found.</span></b><div id='shopperlogin'> <img class='shopperlogintext' src='images/shopperlogin.png'>

   <br />

    <form method='post' action='loginNEW.php' name='loginform' id='loginform'>
    <fieldset>
        <label for='username'>Username:</label><input type='text' name='username' id='username' /><br />
        <label for='password'>Password:</label><input type='password' name='password' id='password' /><br …
Run Code Online (Sandbox Code Playgroud)

php

5
推荐指数
2
解决办法
2233
查看次数

标签 统计

php ×1