Difference between `if (isset($_SESSION))` and `if ($_SESSION)`?
问题 I've noticed that frequently people simply write <?php if($_SESSION['username']) {...} ?> while I have been using: <?php if(isset($_SESSION['username'])) {...} ?> Could someone explain the difference when checking if a variable is set (that's what I'd be using it for)? 回答1: According to PHP.net, isset() does the following: Determine if a variable is set and is not NULL. When writing: <?php if($_SESSION['username']) {...} ?> You are checking to see if $_SESSION['username'] is equal to true. In