<?php
//If the AUTH constant exists for defined('AUTH'), it is true and the subsequent exit will not be accessed. If it is false, execute exit
defined('AUTH') or exit('Access is not allowed due to security factors');
?>
Why output Result: Access is not allowed due to security reasons? The constant AUTH has no value assigned. How can I directly treat it as false and execute exit? ?
寻觅 beyond2017-10-12 23:06:58
<?php if(!defined('AUTH')){ exit("不准访问....") } ?>
The above code is equivalent to yours.
The comment you wrote is correct, but your question seems to be contrary to your comment. You first need to understand that there is a short-circuit theorem. There are two conditions a or b. If a is true, it will not continue to judge whether b is true. Only when a is false, it will judge whether b is true. defined() is equivalent to a, and exit() is equivalent to b. You have already said that AUTH has no value assigned, then defined is false, and exit() is judged, and exit() is always true, so exit() is executed